注意到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. 448. Find All Numbers Disappeared in an Array 寻找有界数组[1,n]中的缺失数

    [抄题]: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice ...

  2. Django--form验证及错误处理

    需求 from表单验证和ajax验证时返回的错误信息处理 速查 1.form表单提交时错误信息显示 views 1 2 error = form表单实例化对象.errors return render ...

  3. pandas dataframe 满足条件的样本提取

    pandas 的dataframe 对 数据查询可以通过3种方式 . 预备知识: 1. pandas 的索引和label都是从0开始的计数的 2. 时间切片都是左闭右开的. [5:6,:]  只会输出 ...

  4. 利用osmosis导出osm城市数据

    转载(未测试) 方法核心就是利用osmosis的导出指定功能,即是从大范围导出小范围的基本用例. 我们只需要知道我们所需要提取的城市的经纬度范围, 例如广州市的经纬度范围是北纬22.26~23.56度 ...

  5. Entity Framework 6.0 Tutorials(5):Command Interception

    Interception: Here, you will learn how to intercept EF when it executes database commands. EF 6 prov ...

  6. Reportng 的测试报告在 Jenkins 中显示不全

    通过Jenkins执行接口测试生成测试报告,用Jenkins的web服务打开html显示不全. 环境: Jenkins版本:1.651.2 Jenkins发布在mac上面 使用的是testng管理测试 ...

  7. Java之集合框架vector类设计原理

  8. 状态压缩DP----HDU2809

    状态压缩DP的一道较不错的入门题,第二次做这类问题,感觉不是很顺手,故记录下来. 题目的意思就是吕布战群雄,先给你6个数,分别是吕布的攻击值,防御值,生命值,升级后此三值各自的增量,然后是对手的个数n ...

  9. Unity3D管网分析

    给大家分享一下自己之前没事写的Unity3D的插件,主要用来对管网的搭建和分析, 开源在Github上 https://github.com/LizhuWeng/PipeNet,可以给需要的朋友做一个 ...

  10. 三、SpringBoot-application.properties配置文件和application.yml配置文件

    其实SpringBoot的配置文件有.properties和.yml两种形式,两种配置文件的效果类似,只不过是格式不同而已,孩儿们可以根据下面这几种张截图,通过对比端口号的配置,以及连接SQLServ ...