比赛 |
20120705 |
评测结果 |
WWWWWWWWWW |
题目名称 |
绘画 |
最终得分 |
0 |
用户昵称 |
CC |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2012-07-05 11:47:34 |
显示代码纯文本
#include <cstdio>
#include <algorithm>
struct question {
int type;
int x1,x2,y1,y2,c;
}task[100005];
int n,m,K,tot;
char order[10],save[100005];
int a[1005][1005];
void work(int u) {
if (u == 0) return;
if (task[u].type == 3) {
work(save[task[u].c]);
return;
}
else if (task[u].type == 2) {
work(u - 1);
return;
}
else if (task[u].type == 1) {
work(u - 1);
int x1 = task[u].x1,x2 = task[u].x2,y1 = task[u].y1,y2 = task[u].y2;
for (int i = x1;i <= x2;i++)
for (int j = y1;j <= y2;j++)
if ((((i - x1) % 2) + ((j - y1) % 2)) % 2) continue;
else a[i][j] = task[u].c;
return;
}
}
int main() {
freopen("drawing.in","r",stdin);
freopen("drawing.out","w",stdout);
scanf("%d%d%d", &n, &K, &m);
tot = 0;
for (int i = 0;i < n;i++)for (int j = 0;j < n;j++) a[i][j] = 1;
for (int i = 1;i <= m;i++) {
scanf("%s",order);
if (order[0] == 'P') {
task[i].type = 1;
scanf("%d%d%d%d%d\n", &task[i].c, &task[i].x1, &task[i].y1, &task[i].x2, &task[i].y2);
}
else if (order[0] == 'S') {
task[i].type = 2;
task[i].c = ++tot;
save[tot] = i;
}
else if (order[0] == 'L') {
task[i].type = 3;
scanf("%d\n", &task[i].c);
}
}
work(m);
for (int i = 0;i < n;i++) {
for (int j = 0;j < n;j++) printf("%d ", a[i][j]);
printf("\n");
}
return 0;
}