记录编号 |
26763 |
评测结果 |
AAAAAAAAAA |
题目名称 |
失落的猴子 |
最终得分 |
100 |
用户昵称 |
老虎小飞 |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.997 s |
提交时间 |
2011-07-25 22:14:20 |
内存使用 |
118.47 MiB |
显示代码纯文本
type
fang=record
x1,y1,x2,y2,c:longint;
end;
abc=record
x1,y1,x2,y2,c:longint;
end;
var
ff:array[0..6000000]of fang;
yuan:array[0..5000]of abc;
f:array[0..1000,0..1000]of longint;
n,m,k,i,j,t,xx,yy,x,y,t0,c0,q:longint;
function min(a,b:longint):longint;
begin
if a>b then min:=b
else min:=a;
end;
function max(a,b:longint):longint;
begin
if a>b then max:=a
else max:=b;
end;
procedure cover(x,y,xx,yy,c0,k:longint);
begin
if k=0 then begin
inc(t);
with ff[t] do begin
x1:=x;y1:=y;x2:=xx;y2:=yy;c:=c0;
end;
end
else begin
with ff[k] do begin
if (x>=x1)and(y>=y1)and(xx<=x2)and(yy<=y2) then exit;
if (x>=x2 )or(y>=y2)or(xx<=x1)or(yy<=y1) then begin
cover(x,y,xx,yy,c0,k-1);exit;
end;
if y<y1 then begin
cover(x,y,min(x2,xx),y1,c0,k-1);
end;
if xx>x2 then begin
cover(x2,y,xx,min(yy,y2),c0,k-1);
end;
if yy>y2 then begin
cover(max(x1,x),y2,xx,yy,c0,k-1);
end;
if x<x1 then begin
cover(x,max(y1,y),x1,yy,c0,k-1);
end;
end;
end;
end;
begin
assign(input,'lostmonkey.in');reset(input);
assign(output,'lostmonkey.out');rewrite(output);
read(n,m,k);
for i:=1 to k do begin
with yuan[i] do begin
read(x1,y1,x2,y2,c);
end;
end;
for i:=k downto 1 do begin
with yuan[i] do begin
x:=x1-1;y:=y1-1;xx:=x2;yy:=y2;c0:=c;
end;
cover(x,y,xx,yy,c0,t);
end;
for k:=1 to t do begin
with ff[k] do begin
for i:=x1+1 to x2 do
for j:=y1+1 to y2 do
f[i,j]:=c;
end;
end;
for i:=1 to n do begin
for j:=1 to m do
write(f[i,j]);
writeln;
end;
close(input);close(output);
end.