题目链接 Print Check

注意到行数加列数最大值只有几千,那么有效的操作数只有几千,那么把这些有效的操作求出来依次模拟就可以了。

 #include <bits/stdc++.h>

 using namespace std;

 #define rep(i,a,b)              for(int i(a); i <= (b); ++i)
const int N = + ;
const int Q = + ; struct node{
int op, x, y;
} a[N]; int col[Q][Q];
int v[N]; //v[i] = 1 则第i个操作需要被执行
int c[][Q];
int n, m, k, op, x, y; int main(){ scanf("%d%d%d", &n, &m, &k);
rep(i, , k){
scanf("%d%d%d", &op, &x, &y);
c[op][x] = i;
a[i].op = op, a[i].x = x, a[i].y = y;
} rep(i, , n) if (c[][i]) v[c[][i]] = ;
rep(i, , m) if (c[][i]) v[c[][i]] = ; rep(i, , k) if (v[i]){
if (a[i].op == ){
rep(j, , m) col[a[i].x][j] = a[i].y;
}
else{
rep(j, , n) col[j][a[i].x] = a[i].y;
}
} rep(i, , n){
rep(j, , m) printf("%d ", col[i][j]);
putchar();
} return ; }

Codeforces 631B Print Check (思维)的更多相关文章

  1. CodeForces 631B Print Check

    对于每一个格子,看是行最后画还是列最后画.预处理一下就可以了. #include<stdio.h> #include<string.h> int n,m,k; +]; +]; ...

  2. Codeforces 631B Print Check【模拟】

    题意: 按顺序给定列和行进行涂色,输出最终得到的方格颜色分布. 分析: 记录下涂的次序,如果某个元素的横和列都被涂过,那么就选择次序最大的颜色. 代码: #include<iostream> ...

  3. CodeForces 631C Print Check

    排序+构造+预处理 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm ...

  4. codeforces 631B B. Print Check

    B. Print Check time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 存储构造题(Print Check)

    连接:Print Check 题意:n行m列的矩阵,有k次涂色,每一涂一行或者一列,求最后的涂色结果. 从数据的大小看,暴力肯定要TLE: 问题是如何存储数据. 首先:我们只要最后的涂色结果. 其次: ...

  9. Maximal GCD CodeForces - 803C (数论+思维优化)

    C. Maximal GCD time limit per test 1 second memory limit per test 256 megabytes input standard input ...

随机推荐

  1. Python中函数参数类型和参数绑定

    参数类型 Python函数的参数类型一共有五种,分别是: POSITIONAL_OR_KEYWORD(位置参数或关键字参数) VAR_POSITIONAL(可变参数) KEYWORD_ONLY(关键字 ...

  2. msconfig.exe

    msconfig.exe 编辑 本词条缺少概述.名片图,补充相关内容使词条更完整,还能快速升级,赶紧来编辑吧!   中文名 微软系统配置实用程序 外文名 msconfig.exe 出品者 Micros ...

  3. Python中@property和@classmethod和@staticmethod

    前戏 首先,先要弄清楚一个类里面的,各个组成部分都应该怎么称呼. - 注:可能叫法会不太一样. 关于@property 顾名思义:它的意思为‘属性’. 作用: 1:使用它你将会把类方法,变为类属性.并 ...

  4. TopK-微博今日热门话题

    大纲 TopK on single node TopK on multiple nodes Realtime topK with low QPS Realtime topK with high QPS ...

  5. Python多进程之multiprocessing模块和进程池的实现

    1.利用multiprocessing可以在主进程中创建子进程,提升效率,下面是multiprocessing创建进程的简单例子,和多线程的使用非常相似 ''' 代码是由主进程里面的主线程从上到下执行 ...

  6. JVM虚拟机系列(三)Class文件格式

  7. springMvc的400问题

    主要是参数类型对不上导致的 本文主要记录一些作者在使用spring mvc过程中遇到的一些以及解决办法,以备日后查询或者供其他网友阅读,每个问题的解决办法肯定不止一种,如果你也遇到过类似问题,并且有独 ...

  8. Ambari API 验证方式

    文章作者:luxianghao 文章来源:http://www.cnblogs.com/luxianghao/p/6123010.html  转载请注明,谢谢合作. 免责声明:文章内容仅代表个人观点, ...

  9. 【bzoj4896】[Thu Summer Camp2016]补退选 Trie树+STL-vector

    题目描述 X是T大的一名老师,每年他都要教授许多学生基础的C++知识.在T大,每个学生在每学期的开学前都需要选课,每次选课一共分为三个阶段:预选,正选,补退选:其中"补退选"阶段最 ...

  10. HDU 5289 Assignment(二分+RMQ-ST)

    Assignment Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total ...