CodeForces 631B Print Check
对于每一个格子,看是行最后画还是列最后画。预处理一下就可以了。
#include<stdio.h>
#include<string.h> int n,m,k;
int op[+];
int id[+];
int info[+];
int high[+]; int main()
{
scanf("%d%d%d",&n,&m,&k);
memset(high,-,sizeof high); for(int i=;i<=k;i++)
scanf("%d%d%d",&op[i],&id[i],&info[i]); for(int i=k;i>=;i--)
{
int y;
if(op[i]==) y=id[i];
else y=id[i]+n; if(high[y]==-) high[y]=i;
} for(int i=;i<=n;i++)
{
for(int j=;j<=m;j++)
{
if(high[i]==-&&high[j+n]==-) printf("0 ");
else if(high[i]==-&&high[j+n]!=-) printf("%d ",info[high[j+n]]);
else if(high[i]!=-&&high[j+n]==-) printf("%d ",info[high[i]]);
else
{
if(high[i]>high[j+n]) printf("%d ",info[high[i]]);
else printf("%d ",info[high[j+n]]);
}
}
printf("\n");
}
return ;
}
CodeForces 631B Print Check的更多相关文章
- Codeforces 631B Print Check (思维)
题目链接 Print Check 注意到行数加列数最大值只有几千,那么有效的操作数只有几千,那么把这些有效的操作求出来依次模拟就可以了. #include <bits/stdc++.h> ...
- Codeforces 631B Print Check【模拟】
题意: 按顺序给定列和行进行涂色,输出最终得到的方格颜色分布. 分析: 记录下涂的次序,如果某个元素的横和列都被涂过,那么就选择次序最大的颜色. 代码: #include<iostream> ...
- CodeForces 631C Print Check
排序+构造+预处理 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm ...
- codeforces 631B B. Print Check
B. Print Check time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- Codeforces Round #344 (Div. 2) B. Print Check 水题
B. Print Check 题目连接: http://www.codeforces.com/contest/631/problem/B Description Kris works in a lar ...
- Codeforces Round #344 (Div. 2) B. Print Check
B. Print Check time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- Codeforces Round #344 (Div. 2) 631 B. Print Check (实现)
B. Print Check time limit per test1 second memory limit per test256 megabytes inputstandard input ou ...
- 存储构造题(Print Check)
连接:Print Check 题意:n行m列的矩阵,有k次涂色,每一涂一行或者一列,求最后的涂色结果. 从数据的大小看,暴力肯定要TLE: 问题是如何存储数据. 首先:我们只要最后的涂色结果. 其次: ...
- Codeforces - 631B 水题
注意到R和C只与最后一个状态有关 /*H E A D*/ struct node2{ int kind,las,val,pos; node2(){} node2(int k,int l,int v,i ...
随机推荐
- Openlayers 3 图层探查功能
<body> <div id="map"></div> <script> var map=new ol.Map({ target:& ...
- stl function扩展(一)
#ifndef _FUNCTION_LIB_H_ #define _FUNCTION_LIB_H_ #include <functional> namespace function_lib ...
- JS-DOM操作应用高级(一)
表格应用--tBodies tHead tFoot rows cells <title>无标题文档</title> <script> window.onlo ...
- C语言开发工具
1.编写程序的工具: indent命令将自动调整C代码的缩进风格,个人比较喜欢indent -kr 2.编译C语言程序: 1.gcc编译器: gcc是一个ANSI C兼容编译器,C++编译器也可以编译 ...
- HDU 4828 Grids(卡特兰数+乘法逆元)
首先我按着我的理解说一下它为什么是卡特兰数,首先卡特兰数有一个很典型的应用就是求1~N个自然数出栈情况的种类数.而这里正好就对应了这种情况.我们要满足题目中给的条件,数字应该是从小到大放置的,1肯定在 ...
- synchronized关键字以及实例锁 类锁
Java语言的关键字,当它用来修饰一个方法或者一个代码块的时候,能够保证在同一时刻最多只有一个线程执行该段代码. 一.当两个并发线程访问同一个对象object中的这个synchronized(this ...
- HDU 2671 Can't be easier
简单的几何题目 点(a,b)关于直线Ax+By+C=1对称点的公式 #include<cstdio> #include<cstring> #include<cmath&g ...
- 批量文件重命名工具-极力推荐 advanced renamer
http://www.advancedrenamer.com/ 功能太强大了,自己慢慢探索吧.
- CSS3线性渐变
万恶的IE!!! <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...
- What is “Mock You” :Raise,callback,verify [转载]
http://www.cnblogs.com/wJiang/archive/2010/02/21/1670637.html Raise 如果你说会用Setup,那么Raise就更简单了.这里注意下它是 ...