比赛 |
20110730 |
评测结果 |
AAAAAAAAAA |
题目名称 |
朦胧之旅 |
最终得分 |
100 |
用户昵称 |
wo shi 刘畅 |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2011-07-30 09:49:13 |
显示代码纯文本
var
n,m,s,i,j,ans,x,y,z,min:longint;
b:array[0..100000]of longint;
c:array[0..100000]of boolean;
g:array[0..5000,0..4000]of longint;
function path(k:longint):boolean;
var
j,i:longint;
begin
for j:=1 to g[k,0] do
begin
i:=g[k,j];
if not c[i] then
begin
c[i]:=true;
if (b[i]=0)or(path(b[i])) then
begin
b[i]:=k;
exit(true);
end;
end;
end;
exit(false);
end;
begin
assign(input,'lovetravel.in'); reset(input);
assign(output,'lovetravel.out'); rewrite(output);
readln(n,m,s);
min:=maxlongint;
for i:=1 to s do
begin
readln(x,y,z);
inc(g[x,0]);
g[x,g[x,0]]:=n+y;
if z<min then min:=z;
end;
ans:=0;
for i:=1 to n do
begin
for j:=n+1 to n+n do c[j]:=false;
if path(i) then inc(ans);
end;
if n=ans then writeln(min,' ',1)
else writeln(0,' ',n-ans);
close(input);
close(output);
end.