记录编号 |
1283 |
评测结果 |
WWAWWWWW |
题目名称 |
求图形面积 |
最终得分 |
10 |
用户昵称 |
苏轼 |
是否通过 |
未通过 |
代码语言 |
Pascal |
运行时间 |
0.054 s |
提交时间 |
2008-08-29 14:13:53 |
内存使用 |
0.00 MiB |
显示代码纯文本
program cch(input,output);
const
xx:array[1..4] of integer=(-1,0,1,0);
yy:array[1..4] of integer=(0,1,0,-1);
var
s:array[0..30,0..30] of integer;
ans:array[1..64,1..100] of integer;
a,b,i,j,k,n,x1,x2,y1,y2,z,q:integer;
procedure floodfill(x,y,c:integer);
var
i,x1,y1:integer;
begin
s[x,y]:=0;
inc(ans[c,q]);
for i:=1 to 4 do
begin
x1:=xx[i]+x; y1:=yy[i]+y;
if (x1>=1)and(x1<=b)and(y1>=1)and(y1<=a) then
if s[x1,y1]=c then
floodfill(x1,y1,c);
end;
end;
begin
assign(input,'area.in');
assign(output,'area.out');
reset(input);
rewrite(output);
readln(a,b,n);
fillchar(ans,sizeof (ans),0);
for i:=1 to b do
for j:=1 to a do
s[i,j]:=1;
for i:=1 to n do
begin
readln(x1,y1,x2,y2,z);
for j:=(x1+a div 2) to (x2+a div 2-1) do
for k:=(y1+b div 2) to (y2+b div 2-1) do
s[k,j]:=z;
end;
{for i:=b downto 1 do
begin
for j:=1 to a do
write(s[i,j],' ');
writeln;
end;}
for i:=b downto 1 do
for j:=1 to a do
if (s[i,j]<>0)then
begin
q:=1;
while ans[s[i,j],q]<>0 do inc(q);
floodfill(i,j,s[i,j]);
end;
for i:=1 to 64 do
if ans[i,1]<>0 then
begin
q:=1;
while ans[i,q]<>0 do
begin
writeln(i,' ',ans[i,q]);
inc(q);
end;
end;
close(input);
close(output);
end.