Codeforces - 631B 水题
注意到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 水题的更多相关文章
- Pearls in a Row CodeForces 620C 水题
题目:http://codeforces.com/problemset/problem/620/C 文章末有一些测试数据仅供参考 题目大意 给你一个数字串,然后将分成几个部分,要求每个部分中必须有一对 ...
- 【Codeforces自我陶醉水题篇~】(差17C code....)
Codeforces17A 题意: 有一种素数会等于两个相邻的素数相加 如果在2~n的范围内有至少k个这样的素数,就YES,否则就NO; 思路: 采用直接打表,后面判断一下就好了.那个预处理素数表还是 ...
- CodeForces 327B 水题。
I - 9 Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Statu ...
- 水题 Codeforces Round #302 (Div. 2) A Set of Strings
题目传送门 /* 题意:一个字符串分割成k段,每段开头字母不相同 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 */ #include <cstdio> ...
- 水题 Codeforces Round #300 A Cutting Banner
题目传送门 /* 水题:一开始看错题意,以为是任意切割,DFS来做:结果只是在中间切出一段来 判断是否余下的是 "CODEFORCES" :) */ #include <cs ...
- Codeforces Testing Round #8 B. Sheldon and Ice Pieces 水题
题目链接:http://codeforces.com/problemset/problem/328/B 水题~ #include <cstdio> #include <cstdlib ...
- 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 ...
- Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)
Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...
- Educational Codeforces Round 7 B. The Time 水题
B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...
随机推荐
- ZIP压缩格式与RAR压缩格式
早已习惯了安装系统之后必须安装winrar,压缩文件也已经习惯了rar格式,这种习惯的力量真的挺可怕的.在工作中你的同事可能没有安装winrar,或者他们不喜欢安装盗版软件,这时候你给他们发送过去的是 ...
- 数字图像处理实验(13):PROJECT 05-04,Parametric Wiener Filter 标签: 图像处理MATLAB 2017-05-27 10:59
实验要求: Objective: To understand the high performance of the parametric Wiener Filter in image restora ...
- 468C Hack it!
传送门 题目大意 分析 here 对于最后求p的过程我想再说一下 那个45就是最前一位分别是0~9,所以总贡献就是45乘上每一种数开头对应多少种情况 而后面的10则是他前面可以填多少不同的数对他做的贡 ...
- 529A And Yet Another Bracket Sequence
传送门 题目大意 给定有一个长度为n n的括号序列,现在有两种操作: 在任意一个位置插入有一个左括号或右括号 将末尾的一个括号放到最前面 可以对这个序列进行若干次操作,问在使括号序列合法的前提下,长度 ...
- Spring下面的@Transactional注解标志的讲解
最近在开发中对Spring中的事务标记@Transactional用的比较多,今天上网收集了一些内容,做一个简单的总结~~~ 在service类前加上@Transactional,声明这个servic ...
- Mysql处理海量数据时的一些优化查询速度方法(转)
最近一段时间由于工作需要,开始关注针对Mysql数据库的select查询语句的相关优化方法. 由于在参与的实际项目中发现当mysql表的数据量达到百万级时,普通SQL查询效率呈直线下降,而且如果whe ...
- dev初识 拖动分组
1.前台代码 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm ...
- getContextPath、getServletPath、getRequestURI,getRealPath的区别
假定你的web application 项目名称为news,你在浏览器中输入请求路径: http://localhost:8080/news/main/list.jsp 则执行下面向行代码后打印出如下 ...
- ASP.NET MVC5 Authentication Filters执行链
注意区分认证和授权: The following are the differences in short: Authentication(认证): It is a process of verif ...
- URAL 1356. Something Easier(哥德巴赫猜想)
题目链接 题意 : 给你一个数n,让你找出几个素数,使其相加为n,输出这些素数. 思路 : 哥德巴赫猜想 : 任何一个大于 6的偶数都可以表示成两个素数之和. 任何一个大于9的奇数都可以表示成三个素数 ...