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 ...
随机推荐
- 【stack】模拟网页浏览 poj 1028
#include<stdio.h> #include<string.h> int main() { ][]; ]; int i,depth; strcpy(s[]," ...
- Struts2实现国际化
public class I18nAction extends ActionSupport { private static final long serialVersionUID = -693330 ...
- 4位开锁<dfs>
题意: 有一个四位密码的锁,每一位是1~9的密码,1跟9相连.并且相邻的连个密码位可以交换.每改变一位耗时1s,给出锁的当前状态和密码,求最少解锁时间. 思路: 用bfs枚举出所有相邻交换的情况,并记 ...
- fidder 调试本地文件
- Android中的对话框AlertDialog使用技巧合集-转载
Android中的对话框AlertDialog使用技巧合集 文章来自:http://blog.csdn.net/blue6626/article/details/6641105 今天我用自 ...
- 快学Scala-第九章 文件和正则表达式
知识点: 1.读取文件中的所有行,可以调用scala.io.Source对象的getLines方法: import scala.io.Source val source = Source.from(& ...
- jenkins tags
List Subversion tags (and more) 参数设置 Tags filter ^((?!_ta_).)*$ 表示不含_ta_ Tags filtertrunk|(tags|bran ...
- 2016.10.08--Intel Code Challenge Final Round--D. Dense Subsequence
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- Python基础学习8---list列表的操作
a_list = ['hello','world',1,'shanghai',3.99] #列表添加操作的4种方法 #1. 通过+ 字符来拼接 a_list = a_list + [1,'wuhan' ...
- 向页面动态添加外部js
var script = document.createElement("script"); script.src = '/static/js/view/'+url+'.js'; ...