记录编号 |
4074 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[USACO Nov07] 最大的湖 |
最终得分 |
100 |
用户昵称 |
苏轼 |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.010 s |
提交时间 |
2008-10-13 19:05:06 |
内存使用 |
0.32 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
- i,j,k,m,n,tot,max,x,y:integer;
- a:array[1..100,1..100] of boolean;
- ans:array[1..100000] of integer;
-
- procedure floodfill(x,y:integer);
- var
- i,x1,y1:integer;
- begin
- inc(ans[tot]);
- a[x,y]:=false;
- for i:=1 to 4 do
- begin
- x1:=x+xx[i]; y1:=y+yy[i];
- if (x1>=1)and(x1<=n)and(y1>=1)and(y1<=m) then
- if a[x1,y1] then
- floodfill(x1,y1);
- end;
- end;
-
- begin
- assign(input,'lake.in');
- assign(output,'lake.out');
- reset(input);
- rewrite(output);
- readln(n,m,k);
- for i:=1 to n do
- for j:=1 to m do
- a[i,j]:=false;
- for i:=1 to k do
- begin
- readln(x,y);
- a[x,y]:=true;
- end;
- tot:=0;
- for i:=1 to n do
- for j:=1 to m do
- if a[i,j] then
- begin
- inc(tot);
- ans[tot]:=0;
- floodfill(i,j);
- end;
- max:=0;
- for i:=1 to tot do
- if ans[i]>max then max:=ans[i];
- write(max);
- close(input);
- close(output);
- end.