注意到R和C只与最后一个状态有关

/*H E A D*/
struct node2{
int kind,las,val,pos;
node2(){}
node2(int k,int l,int v,int p){
kind=k;las=l;
val=v;pos=p;
}
}b[maxn];
bool cmp(node2 a,node2 b){
return a.las<b.las;
}
int mt[5003][5003];
int main(){
int n,m,k,op;
while(~iin(n)){
m=read();k=read();
int N=0,kind,pos,val;
rep(i,1,n) b[i].kind=1;
rep(i,n+1,n+m) b[i].kind=2;
rep(i,1,n+m) b[i].val=b[i].las=0,b[i].pos=i>n?i-n:i;
rep(i,1,k){
kind=read();
pos=read();
val=read();
if(kind==1){
b[pos]=node2(1,i,val,pos);
}else{
b[n+pos]=node2(2,i,val,pos);
}
}
sort(b+1,b+n+m+1,cmp);
rep(i,1,n+m){
if(b[i].kind==1){
rep(j,1,m){
mt[b[i].pos][j]=b[i].val;
}
}else if(b[i].kind==2){
rep(j,1,n){
mt[j][b[i].pos]=b[i].val;
}
}
}
rep(i,1,n) rep(j,1,m){
if(j==m){
println(mt[i][j]);
}else{
print(mt[i][j]);blank;
}
}
}
return 0;
}

Codeforces - 631B 水题的更多相关文章

  1. Pearls in a Row CodeForces 620C 水题

    题目:http://codeforces.com/problemset/problem/620/C 文章末有一些测试数据仅供参考 题目大意 给你一个数字串,然后将分成几个部分,要求每个部分中必须有一对 ...

  2. 【Codeforces自我陶醉水题篇~】(差17C code....)

    Codeforces17A 题意: 有一种素数会等于两个相邻的素数相加 如果在2~n的范围内有至少k个这样的素数,就YES,否则就NO; 思路: 采用直接打表,后面判断一下就好了.那个预处理素数表还是 ...

  3. CodeForces 327B 水题。

    I - 9 Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Statu ...

  4. 水题 Codeforces Round #302 (Div. 2) A Set of Strings

    题目传送门 /* 题意:一个字符串分割成k段,每段开头字母不相同 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 */ #include <cstdio> ...

  5. 水题 Codeforces Round #300 A Cutting Banner

    题目传送门 /* 水题:一开始看错题意,以为是任意切割,DFS来做:结果只是在中间切出一段来 判断是否余下的是 "CODEFORCES" :) */ #include <cs ...

  6. Codeforces Testing Round #8 B. Sheldon and Ice Pieces 水题

    题目链接:http://codeforces.com/problemset/problem/328/B 水题~ #include <cstdio> #include <cstdlib ...

  7. Codeforces Round #356 (Div. 2)B. Bear and Finding Criminals(水题)

    B. Bear and Finding Criminals time limit per test 2 seconds memory limit per test 256 megabytes inpu ...

  8. Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)

    Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...

  9. Educational Codeforces Round 7 B. The Time 水题

    B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...

随机推荐

  1. 何为软件的Alpha、Beta、RC和GA发布版本?

    简介 一个软件或者一个功能在发布时,通常会有Beta版这么一说.我很熟悉,差不多知道是什么意思,但没去深究,感觉上就是一个可以用但不保证功能稳定的版本. 直到昨天我看到了 MariaDB 数据库发布标 ...

  2. python核心编程第5章课后题答案

    5-8Geometry import math def sqcube(): s = float(raw_input('enter length of one side: ')) print 'the ...

  3. java IO 对象流 反序列化和序列化

    例: 重点:需要序列化的对象必须实现Serializable接口 //需要序列化的对象 public class User implements Serializable { private Stri ...

  4. (转)Asp.Net底层原理(三、Asp.Net请求响应过程)

    原文地址:http://www.cnblogs.com/liuhf939/archive/2013/09/16/3324753.html 在之前,我们写了自己的Asp.Net框架,对整个流程有了一个大 ...

  5. cad转shapefile文件

    private ESRI.ArcGIS.Controls.AxTOCControl axTOCControl1; private ESRI.ArcGIS.Controls.AxLicenseContr ...

  6. 编写高质量代码改善C#程序的157个建议——建议21:选择正确的集合

    建议21:选择正确的集合 要选择正确的集合,首先要了解一些数据结构的知识.所谓数据结构,就是相互之间存在一种或多种特定关系的数据元素的集合. 集合的分类参考下图: 由于非泛型集合存在效率低及非类型安全 ...

  7. 【Head First Java 读书笔记】(五)编写程序

    第五章 编写程序 伪码:伪码能帮你专注于逻辑而不需要顾虑到程序语法 测试码:测试用的程序代码 真实码:实际代码 伪码 伪码是介于真正的java程序与正常英语之间的一种语言.伪码大致包括3部分:实例变量 ...

  8. MVC上的jsonp扩展,解决跨域访问问题

    总是有人会遇到跨域问题,然后有个jsonp的解决方案,MVC中代码如下: public class JsonpResult : System.Web.Mvc.JsonResult { object d ...

  9. C# 给图片添加透明的文字、图片水印

    #region 添加水印 /// <summary> /// 添加文字水印 /// </summary> /// <param name="image" ...

  10. C# 抽象

    好多人将抽象类也作为多态的一种,其实我觉得并不是特别的好. 抽象在C#中是类的一种表现. 如果将类作为多态,那么前面所有的东西不就白费了吗? C#的 抽象很简单. 那就是抽象. 基本就是高度抽象. 那 ...