题目链接 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. HUD:2896-病毒侵袭

    传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2896 病毒侵袭 Time Limit: 2000/1000 MS (Java/Others) Memor ...

  2. 华东交通大学2018年ACM“双基”程序设计竞赛 D

      摸鱼之王MIKU酱想去埃及玩,需要一个人陪同.小新和小磊都想陪MIKU酱一起去,但名额只有一个.所以小磊和小新决定用一个小游戏来决定谁和MIKU酱出去玩.    游戏的道具是21张塔罗牌,塔罗牌分 ...

  3. Eclipse快速输出System.out.println();

    借鉴网上大佬博客 刚开始还好好敲代码 后来看博客发现其实输入syso或sysout 再按alt+/就OK 开始学JAVA,好好干.

  4. HDU_6194 后缀数组+RMQ

    好绝望的..想了五个多小时,最后还是没A...赛后看了下后缀数组瞬间就有了思路...不过因为太菜,想了将近两个小时才吧这个题干掉. 首先,应当认为,后缀数组的定义是,某字符串S的所有后缀按照字典序有小 ...

  5. 笔记-python-selenium,phantomjs

    笔记-python-selenium,phantomjs 1.      简介 1.1.    selenium selenium是一款自动化测试工具,支持多种语言 为什么爬虫要使用selenium呢 ...

  6. appcompat_v7\res\values-v21\themes_base.xml:158: error: Error: No resource

    C:\DevelopSoft\workspace\appcompat_v7\res\values-v21\themes_base.xml:158: error: Error: No resource ...

  7. 设计模式之第4章-装饰模式(Java实现)

    设计模式之第4章-装饰模式(Java实现) “怎么了,鱼哥?” “唉,别提了,网购了一件衣服,结果发现和商家描述的差太多了,有色差就算了,质量还不好,质量不好就算了,竟然大小也不行,说好的3个X,邮的 ...

  8. 微信小程序-----校园头条详细开发之注册登录

    1.注册登录功能的实现 1.1结构 1.2 代码实现 1.2.1  为了通信的安全着想,在此我是通过小程序端获得code,然后传递给后端,在后端向微信后台发送api请求,解密,从而得到用户的唯一标示o ...

  9. python 学习分享-函数篇2

    递归 自己玩自己的函数: 1. 必须有一个明确的结束条件 2. 每次进入更深一层递归时,问题规模相比上次递归都应有所减少 3. 递归效率不高,递归层次过多会导致栈溢出 递归例子和二分查找都放在里面了 ...

  10. [HTTPS]pfx转jks

    keytool -importkeystore -srckeystore  src.pfx -srcstoretype pkcs12 -destkeystore trg.jks -deststoret ...