【题解】CF631B Print Check】的更多相关文章

题面传送门 解决思路: 首先考虑到,一个点最终的情况只有三种可能:不被染色,被行染色,被列染色. 若一个点同时被行.列染色多次,显示出的是最后一次被染色的结果.所以我们可以使用结构体,对每一行.每一列记录下其最后一次被染色的颜色和时间.因为同行或同列反复染只有最后一次有影响,所以后来的直接覆盖之前的即可. 一个点的最终结果:若最后一次染行晚于最后一次染列,则显示最后一次染行的颜色,反之显示最后一次染列的颜色. 然后程序就很简单了. AC Code: #include<bits/stdc++.h>…
B. Print Check 题目连接: http://www.codeforces.com/contest/631/problem/B Description Kris works in a large company "Blake Technologies". As a best engineer of the company he was assigned a task to develop a printer that will be able to print horizon…
B. Print Check time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Kris works in a large company "Blake Technologies". As a best engineer of the company he was assigned a task to develop a…
连接:Print Check 题意:n行m列的矩阵,有k次涂色,每一涂一行或者一列,求最后的涂色结果. 从数据的大小看,暴力肯定要TLE: 问题是如何存储数据. 首先:我们只要最后的涂色结果. 其次:没有必要用for每个数据涂一遍. 所以如果能一次直接涂一行就可以了: #include <iostream> #include <cstdio> uising namespace std; #define N 5005 ; typedef long long LL; int row[N…
B. Print Check time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Kris works in a large company "Blake Technologies". As a best engineer of the company he was assigned a task to develop a…
题目链接 Print Check 注意到行数加列数最大值只有几千,那么有效的操作数只有几千,那么把这些有效的操作求出来依次模拟就可以了. #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i(a); i <= (b); ++i) + ; + ; struct node{ int op, x, y; } a[N]; int col[Q][Q]; int v[N]; //v[i] = 1 则第i个…
B. Print Check time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Kris works in a large company "Blake Technologies". As a best engineer of the company he was assigned a task to develop a pri…
对于每一个格子,看是行最后画还是列最后画.预处理一下就可以了. #include<stdio.h> #include<string.h> int n,m,k; +]; +]; +]; +]; int main() { scanf("%d%d%d",&n,&m,&k); memset(high,-,sizeof high); ;i<=k;i++) scanf("%d%d%d",&op[i],&id[…
排序+构造+预处理 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; + ; int n, m; int a[maxn], ans[maxn]; int op[maxn], e[maxn]; int pos[maxn]; int first, last; int flag; int p; int tot; bool cmp(c…
题意: 按顺序给定列和行进行涂色,输出最终得到的方格颜色分布. 分析: 记录下涂的次序,如果某个元素的横和列都被涂过,那么就选择次序最大的颜色. 代码: #include<iostream> #include<cstdio> using namespace std; const int maxn = 5005; int num[maxn][maxn]; int ma[2][maxn]; int ro[maxn], ca[maxn]; int main (void) { int n,…