比赛 |
20110725 |
评测结果 |
AAAAAAAAAA |
题目名称 |
失落的猴子 |
最终得分 |
100 |
用户昵称 |
reamb |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2011-07-25 11:39:47 |
显示代码纯文本
program shiluodehouzi;
var
x1,y1,x2,y2,c:array[0..5000] of longint;
n:integer;
map:array[0..1000,0..1000] of longint;
procedure init;
var
i:integer;
begin
readln(x2[0],y2[0],n);
x1[0]:=0;
y1[0]:=0;
c[0]:=0;
for i:=1 to n do
begin
readln(x1[i],y1[i],x2[i],y2[i],c[i]);
x1[i]:=x1[i]-1;
y1[i]:=y1[i]-1
end
end;
procedure cover(l,r,s,d,k,col:integer);
var
i,j:longint;
begin
while (k<=n) and ((r<=x1[k]) or (l>=x2[k]) or (d<=y1[k]) or (s>=y2[k])) do
inc(k);
if k>n then
begin
for i:=l+1 to r do
for j:=s+1 to d do
map[i,j]:=col;
exit;
end;
if l<=x1[k] then
begin
cover(l,x1[k],s,d,k+1,col);
l:=x1[k];
end;
if r>=x2[k] then
begin
cover(x2[k],r,s,d,k+1,col);
r:=x2[k];
end;
if s<=y1[k] then
begin
cover(l,r,s,y1[k],k+1,col);
s:=y1[k];
end;
if d>=y2[k] then
begin
cover(l,r,y2[k],d,k+1,col);
d:=y2[k];
end;
end;
procedure work;
var
i:integer;
begin
for i:=n downto 0 do
cover(x1[i],x2[i],y1[i],y2[i],i+1,c[i]);
end;
procedure print;
var
i,j:longint;
begin
for i:=1 to x2[0] do
begin
for j:=1 to y2[0] do
write(map[i,j]);
writeln
end
end;
begin
assign(input,'lostmonkey.in');
assign(output,'lostmonkey.out');
reset(input);
rewrite(output);
init;
work;
print;
close(input);
close(output);
end.