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 ...
随机推荐
- WPF(x:Null 使用)
<Window x:Class="TestOfNull.MainWindow" xmlns="http://schemas.microsoft.com/winfx/ ...
- LightOJ 1341 Aladdin and the Flying Carpet 算数基本定理
题目大意:给出面积n,和最短边m,求能形成的矩形的个数(不能为正方形). 题目思路:根据算数基本定理有: 1.每个数n都能被分解为:n=p1^a1*p2^a2*^p3^a3……pn^an(p为素数); ...
- linux的学习系列 7---管道和过滤器
有时候,我们可以把两个命令连起来使用,一个命令的输出作为另一个命令的输入,这就叫做管道.为了建立管道,需要在两个命令之间使用竖线(|)连接. 管道是Linux进程之间一种重要的通信机制:除了管道,还有 ...
- SSH整合环境下Spring配置文件的配置
applicationContext.xml: <?xml version="1.0" encoding="UTF-8"?> <beans x ...
- combo扩展:禁止手工改变输入框的值
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- sessionStorage用于分页,瀑布流和存储用户数据等
在手机网页开发中,会用到分页和瀑布流来分量显示数据.这里会遇到一个问题.当点击某条数据进入详情后,再按手机的返回键会到上一个页面,该页面是重新加载的. 本人在微信里用内置的qq浏览器打开页面,wind ...
- HDU1372:Knight Moves(BFS)
Knight Moves Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total ...
- CodeForces 696A Lorenzo Von Matterhorn (LCA + map)
方法:求出最近公共祖先,使用map给他们计数,注意深度的求法. 代码如下: #include<iostream> #include<cstdio> #include<ma ...
- Git学习 -- 冲突解决
当连个分支对统一文件提交了不同修改时,可能会出现冲突,例如: $ git merge feature1 Auto-merging readme.txt CONFLICT (content): Merg ...
- opencart配置税率
1.System->Localisation->Geo Zones新增税收区域 2.System->Localisation->Taxes->Tax Rates新增税率 ...