Codeforces 631B Print Check (思维)
题目链接 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 (思维)的更多相关文章
- CodeForces 631B Print Check
对于每一个格子,看是行最后画还是列最后画.预处理一下就可以了. #include<stdio.h> #include<string.h> int n,m,k; +]; +]; ...
- 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: 问题是如何存储数据. 首先:我们只要最后的涂色结果. 其次: ...
- Maximal GCD CodeForces - 803C (数论+思维优化)
C. Maximal GCD time limit per test 1 second memory limit per test 256 megabytes input standard input ...
随机推荐
- qt4.8.5 qtwebkit 静态编译 版本
2013年就编译好了,qtwebkit是最不好编译的了,尤其是静态编译,这儿分享给大家 估计总有人会用得到... 静态库下载地址:http://yunpan.cn/cyyNqrApbVDwq 提取码 ...
- js中基础数据类型
变量声明 undefined //未定义只声明 var age; alert(name);function fc(a1,a2,a3) { //alert(a1); //alert(a2); //a ...
- loj2090 「ZJOI2016」旅行者
分治+最短路,很套路的 #include <algorithm> #include <iostream> #include <cstring> #include & ...
- Java装箱和拆箱
https://www.cnblogs.com/dolphin0520/p/3780005.html http://mxdxm.iteye.com/blog/2028196 装箱过程是通过调用包装器的 ...
- 极简Node教程-七天从小白变大神(二:中间件是核心)
当我们只引入express时,前述的那些功能都是没有启用的.那么,如何将这些功能添加进来呢?express通过其中间件机制实现了这些功能的管理.每一个中间件对应一个功能,而中间件可以是第三方库,也可以 ...
- 构建乘积数组--java
题目:给定一个数组A[0,1,...,n-1],请构建一个数组B[0,1,...,n-1],其中B中的元素B[i]=A[0]*A[1]*...*A[i-1]*A[i+1]*...*A[n-1].不能使 ...
- eslint规范项目代码
安装一系列eslint插件后,填写eslint配置,配置如下 .editorconfig root = true [*] charset = utf-8 indent_style = space in ...
- Ubuntu下建立Pycharm快捷方式
修改 Exec, Icon 路径,将文件保存 pycharm.desktop,拖到unity侧边栏 [Desktop Entry]Categories=Development;Comment[zh_C ...
- 【bzoj1266】[AHOI2006]上学路线route 最短路+最小割
题目描述 可可和卡卡家住合肥市的东郊,每天上学他们都要转车多次才能到达市区西端的学校.直到有一天他们两人参加了学校的信息学奥林匹克竞赛小组才发现每天上学的乘车路线不一定是最优的. 可可:“很可能我们在 ...
- Socket通信入门小实例
客户端: public class Client { private int port = 8000; private String host = "localhost"; pri ...