比赛 |
20120705 |
评测结果 |
AAAAATTTTT |
题目名称 |
绘画 |
最终得分 |
50 |
用户昵称 |
zhangchi |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2012-07-05 11:51:03 |
显示代码纯文本
type
node=record
color,next:longint;
end;
var
i,j,k,n,m,tot,p,s,num,tail,mark,temp:longint;
ch:char;
map1,map2:array[0..1000,0..1000] of node;
which,work,save:array[1..100000] of longint;
opt:array[1..100000,0..4] of longint;
hang:array[1..100000] of longint;
begin
assign(input,'drawing.in'); reset(input);
assign(output,'drawing.out'); rewrite(output);
readln(n,k,m);
for i:=1 to m do
begin
read(ch);
case ch of
'P':begin
read(ch); read(ch); read(ch); read(ch);
inc(p);
hang[p]:=i;
readln(opt[p,0],opt[p,1],opt[p,2],opt[p,3],opt[p,4]);
which[i]:=1;
work[i]:=p;
end;
'S':begin
readln;
inc(s);
save[s]:=hang[p];
which[i]:=2;
work[i]:=p;
end;
'L':begin
read(ch); read(ch); read(ch);
readln(num);
which[i]:=3;
work[i]:=save[num];
end;
end;
end;
for i:=0 to n-1 do
for j:=0 to n-1 do
begin
map1[i,j].next:=j+1;
map2[i,j].next:=j+1;
end;
i:=m;
while i>=1 do
begin
case which[i] of
1:begin
p:=work[i];
if (opt[p,1]+opt[p,2]) mod 2=0 then
begin
for j:=opt[p,1] to opt[p,3] do
begin
tail:=opt[p,2];
while tail<=opt[p,4] do
begin
if map1[j,tail].color=0 then
map1[j,tail].color:=opt[p,0];
tail:=map1[j,tail].next;
end;
mark:=tail;
tail:=opt[p,2];
while tail<=opt[p,4] do
begin
temp:=map1[j,tail].next;
map1[j,tail].next:=mark;
tail:=temp;
end;
end;
end
else
begin
for j:=opt[p,1] to opt[p,3] do
begin
tail:=opt[p,2];
while tail<=opt[p,4] do
begin
if map2[j,tail].color=0 then
map2[j,tail].color:=opt[p,0];
tail:=map2[j,tail].next;
end;
mark:=tail;
tail:=opt[p,2];
while tail<=opt[p,4] do
begin
temp:=map2[j,tail].next;
map2[j,tail].next:=mark;
tail:=temp;
end;
end;
end;
dec(i);
end;
2:dec(i);
3:i:=work[i];
end;
end;
for i:=0 to n-1 do
for j:=0 to n-1 do
begin
if map1[i,j].color=0 then map1[i,j].color:=1;
if map2[i,j].color=0 then map2[i,j].color:=1;
end;
for i:=0 to n-1 do
begin
for j:=0 to n-2 do
if (i+j) mod 2=0 then write(map1[i,j].color,' ') else write(map2[i,j].color,' ');
if (i+n-1) mod 2=0 then writeln(map1[i,n-1].color) else writeln(map2[i,n-1].color);
end;
close(input); close(output);
end.