Description

X is well known artist, no one knows the secrete behind the beautiful paintings of X except his friend Y, well the reason that Y knows X's secrete is that he is that secret. Y is a programmer and he helps X with drawing paintings using computer program written by him. Unfortunately Y program is not working any more, now it's your turn to help X by writing a program that helps him in painting, your program should accept a sequence of instructions, each will draw an opaque (filled) rectangle in the form: r1, c1, r2, c2, color. where (r1, c1) is the upper left corner of the rectangle and (r2, c2) is the lower right corner, and color is a character that denotes the color of this rectangle. all rectangles will be printed on a R by C plane, by default this plane is filled with dots (i.e. '.'). R and C between 1 and 100. for each instruction (1 ≤ ri ≤ R) and (1 ≤ ci ≤ C) and color is a ASCII character [a-z]. The number of instructions won't exceed 100 instructions.

Input

The first line of input contains an integer T denotes number of test cases. The first line of each test case contains three integers RC ,Iwhere R and C denotes number of rows and columns of the painting, and I denotes number of instructions. Each of the next I lines contains four integers r1,c1,r2,c2 and the color character.

Output

Print the final plane after evaluating the instructions in order.

Example
input
1
5 5 3
1 1 2 2 a
1 2 5 5 c
2 2 3 3 d
output
acccc
addcc
.ddcc
.cccc
.cccc
题意:从x1,y1画到x2,y2,颜色为c,问我们最后画出来的颜色分布
解法:暴力,原先画的颜色会被后面的覆盖
#include <iostream>
#include <cstring>
using namespace std;
int main(){
char a[105][105];
int T;
cin>>T;
while(T--){
int c,r,m,b[4];
cin>>r>>c>>m;
for(int i=1;i<=r;i++){
for(int k=1;k<=c;k++){
a[i][k]='.';
}
}
while(m--){
char ch;
for(int i=0;i<4;i++){
cin>>b[i];
}
cin>>ch;
for(int i=b[0];i<=b[2];i++){
for(int k=b[1];k<=b[3];k++){
a[i][k]=ch;
}
}
}
for(int i=1;i<=r;i++){
for(int k=1;k<=c;k++){
cout<<a[i][k];
}
cout<<endl;
}
}
return 0;
}

  

2016 Al-Baath University Training Camp Contest-1 D的更多相关文章

  1. 2016 Al-Baath University Training Camp Contest-1

    2016 Al-Baath University Training Camp Contest-1 A题:http://codeforces.com/gym/101028/problem/A 题意:比赛 ...

  2. 2014-2015 Petrozavodsk Winter Training Camp, Contest.58 (Makoto rng_58 Soejima contest)

    2014-2015 Petrozavodsk Winter Training Camp, Contest.58 (Makoto rng_58 Soejima contest) Problem A. M ...

  3. 2016 Al-Baath University Training Camp Contest-1 E

    Description ACM-SCPC-2017 is approaching every university is trying to do its best in order to be th ...

  4. 2016 Al-Baath University Training Camp Contest-1 B

    Description A group of junior programmers are attending an advanced programming camp, where they lea ...

  5. 2016 Al-Baath University Training Camp Contest-1 A

    Description Tourist likes competitive programming and he has his own Codeforces account. He particip ...

  6. 2016 Al-Baath University Training Camp Contest-1 J

    Description X is fighting beasts in the forest, in order to have a better chance to survive he's gon ...

  7. 2016 Al-Baath University Training Camp Contest-1 I

    Description It is raining again! Youssef really forgot that there is a chance of rain in March, so h ...

  8. 2016 Al-Baath University Training Camp Contest-1 H

     Description You've possibly heard about 'The Endless River'. However, if not, we are introducing it ...

  9. 2016 Al-Baath University Training Camp Contest-1 G

    Description The forces of evil are about to disappear since our hero is now on top on the tower of e ...

  10. 2016 Al-Baath University Training Camp Contest-1 F

    Description Zaid has two words, a of length between 4 and 1000 and b of length 4 exactly. The word a ...

随机推荐

  1. ACM之Java速成(4)

    ACM中Java.进制转换 Java进制转换: 由于Unicode兼容ASCII(0-255),因此,上面得到的Unicode就是ASCII. java中进行二进制,八进制,十六进制,十进制间进行相互 ...

  2. C#: 异步委托

    http://www.cnblogs.com/yingzhongwen/p/4568350.html 讲了委托与事件,但是对异步委托研究得还不够深入. http://www.cnblogs.com/l ...

  3. mvc3在window 7 iis7下以及 xp iis 5.1下的部署 ,asp.net MVC3无法打开项目文件E:/我们的项目/Project/HeatingMIS.Web/HeatingMIS.Web.csproj”。此安装不支持该项目类型。

    今天,小白来总结一下我在is上部署mvc3 .net 网站的时候的过程和遇到的问题. 其实,mvc的网站的部署跟平常的网站的部署都是一样的,只是下面有一些需要注意的地方. 1.应用程序池采用集成模式( ...

  4. 查看真机的系统中sdk的版本

    1.adb devices 确保连接上了真机 2.adb shell 进入android系统 3.进入system目录下 4.查看build.prop文件 cat build.prop

  5. 认识javascript

    javascript小知识 www.phonegap.com(跨平台开发框架) Cocos2d-Html5(WebGL渲染  javascript语言) creatjs.com(融合了flash动画的 ...

  6. C#访问postgresql数据库

    最近开始做C#的DotNet的工作,因为对PostgreSQL数据库比较有兴趣,所以自己研究了一下如何访问PostgreSQL的 数据库的问题. 1.为了访问PostgreSQL数据库,需要从pgfo ...

  7. angular 倒计时

    $scope.countdown = ; var myTime = setInterval(function() { $scope.countdown--; $scope.$digest(); // ...

  8. (转)oracle 查看表所占用的空间大小

    1.查看表所占空间 SELECT   TABLESPACE_NAME,TO_CHAR(SUM(BYTES)/(1024*1024),'999G999D999')   CNT_MB     FROM   ...

  9. 夺命雷公狗ThinkPHP项目之----企业网站26之网站前台列表页的显示和完成分页功能

    我们用大I接收到我们get过来的栏目页的id然后通过文章的ar_cateid 来判断是不是属于该栏目下的,如果文章表ar_cateid = 栏目表的cate_id 那么就可以选出我们要查找的信息, 然 ...

  10. 夺命雷公狗---DEDECMS----30dedecms数据dede_archives主表进行查询l操作

    在plus目录下编写一个test2.php的文件,取出dede_archives的所有信息 <?php //编写test2.php这个文件,主要是为了实现可以取出dede_archives表的所 ...