比赛 |
20130729 |
评测结果 |
AAAATTTEEE |
题目名称 |
捉迷藏 |
最终得分 |
40 |
用户昵称 |
FoolMike |
运行时间 |
3.474 s |
代码语言 |
Pascal |
内存使用 |
95.56 MiB |
提交时间 |
2014-07-17 09:51:31 |
显示代码纯文本
- var
- c,d,e,n,m:longint;
- a:array[1..10000,1..10000]of byte;
- f:array[1..10000]of integer;
- g:array[1..10000]of byte;
-
- procedure ss(w,l:longint);
- var
- i:longint;
- begin
- if (w<>1)and((f[w]=0)or(l<f[w])) then f[w]:=l;
- for i:=1 to n do
- if (a[w,i]=1)and(g[i]=0) then
- begin
- g[i]:=1;
- ss(i,l+1);
- g[i]:=0;
- end;
- end;
-
- begin
- assign(input,'hideseek.in');
- assign(output,'hideseek.out');
- reset(input);
- rewrite(output);
-
- readln(n,m);
- for c:=1 to m do
- begin
- readln(d,e);
- a[d,e]:=1;
- a[e,d]:=1;
- end;
-
- ss(1,0);
- e:=1;d:=0;
- for c:=2 to n do
- begin
- if f[c]>f[e] then
- begin
- e:=c;
- d:=0;
- end;
- if f[c]=f[e] then inc(d);
- end;
-
- writeln(e,' ',f[e],' ',d);
- close(input);close(output);
- end.