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 ...
随机推荐
- Python 网络爬虫 009 (编程) 通过正则表达式来获取一个网页中的所有的URL链接,并下载这些URL链接的源代码
通过 正则表达式 来获取一个网页中的所有的 URL链接,并下载这些 URL链接 的源代码 使用的系统:Windows 10 64位 Python 语言版本:Python 2.7.10 V 使用的编程 ...
- How to safely shut down a loading UIWebView in viewWillDisappear?
up vote24down votefavorite 24 I have a view containing a UIWebView which is loading a google map (so ...
- SqueezeNet:AlexNet-level Accuracy with 50x fewer parameters and less than 0.5Mb model size
- Fire modules consisting of a 'squeeze' layer with 1*1 filters feeding an 'expand' layer with 1*1 a ...
- java多线程的基本介绍
Java多线程 1.进程与线程 进程是程序的一次动态执行过程,它需要经历从代码加载,代码执行到执行完毕的一个完整的过程,这个过程也是进程本身从产生,发展到最终消亡的过程.多进程操作系统能同时达运行多个 ...
- vee-validate表单校验的基本使用
今天主要记录一下用vee-validate来进行表单校验的几个基本使用.包括最基础的必填和长度校验:异步请求服务的校验(重名校验),还有延迟校验.如何引入等就不在这里赘述了,直接进入主题. 1.必填和 ...
- 关于 ASP.NET 的 CompilationMode="Never" 性能问题
今天在优化系统性的时候,想到了 ASP.NET 里的 CompilationMode="Never", 因为用户控件里没有任何代码, 只有控件,把用户控件的编译模式改为 Never ...
- C#多线程编程实战1.3等待线程
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...
- [Algorithm]排序
一.排序算法 1.插入排序 1) 直接插入排序:(插入类) 1 void InsertSort( ElemType R[], int n ) 2 { 3 for ( int i = 2; i < ...
- Mybatis 的动态 SQL 语句
<if>标签 我们根据实体类的不同取值,使用不同的 SQL 语句来进行查询. 比如在 id 如果不为空时可以根据 id 查询, 如果 username 不同空时还要加入用户名作为条件.这种 ...
- poi将图片导入excel(Java代码)
package com.fh.util;import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; imp ...