比赛 |
20110725 |
评测结果 |
TTTTTTTTTT |
题目名称 |
失落的猴子 |
最终得分 |
0 |
用户昵称 |
老虎小飞 |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2011-07-25 13:45:10 |
显示代码纯文本
type
fang=record
x1,y1,x2,y2,c:longint;
end;
var
ff:array[0..6000000]of fang;
xxx:array[0..6000000]of boolean;
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;
begin
assign(input,'lostmonkey.in');reset(input);
assign(output,'lostmonkey.out');rewrite(output);
read(n,m,k);
inc(t);
with ff[t] do begin
x1:=0;y1:=0;
x2:=n;y2:=m; c:=0;
end;
for i:=1 to k do begin
read(x,y,xx,yy,c0);
dec(x);dec(y);
t0:=t;q:=0;
for j:=1 to t0 do begin
if not xxx[j] then
with ff[j] do begin
if (x<=x1)and(y<=y1)and(xx>=x2)and(yy>=y2) then begin
x1:=x;y1:=y;x2:=xx;y2:=yy;c:=c0;q:=1;
continue;
end;
if ( (x2<=x)and(y2<=y) )
or( (xx<=x1)and(y>=y2) )
or( (x1>=xx)and(y1>=yy) )
or( (x>=x2)and(yy<=y1) ) then begin
continue;
end;
if y1<y then begin
inc(t);
ff[t].x1:=x1;ff[t].y1:=y1;ff[t].x2:=min(x2,xx);ff[t].y2:=y;ff[t].c:=c;
end;
if x2>xx then begin
inc(t);
ff[t].x1:=xx;ff[t].y1:=y1;ff[t].x2:=x2;ff[t].y2:=min(y2,yy);ff[t].c:=c;
end;
if y2>yy then begin
inc(t);
ff[t].x1:=max(x,x1);ff[t].y1:=yy;ff[t].x2:=x2;ff[t].y2:=y2;ff[t].c:=c;
end;
if x1<x then begin
inc(t);
ff[t].x1:=x1;ff[t].y1:=max(y,y1);ff[t].x2:=x;ff[t].y2:=y2;ff[t].c:=c;
end;
xxx[j]:=true;
end;
end;
if q=0 then begin
inc(t);
with ff[t] do begin
x1:=x;y1:=y;x2:=xx;y2:=yy;c:=c0;
end;
end;
end;
for k:=1 to t do begin
if not xxx[k] then
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.