比赛 |
HAOI2009 模拟试题4 |
评测结果 |
AAAAAAWAWA |
题目名称 |
K- 联赛 |
最终得分 |
80 |
用户昵称 |
.Xmz |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2009-04-24 10:42:12 |
显示代码纯文本
program xmz;
var
w,d:array[1..25]of integer;
a:array[1..25,1..25]of integer;
f1,f2:text;
ddd,n:integer;
procedure cs;
var i,j:integer;
begin
for i:=1 to n do
read(f1,w[i],d[i]);
for i:=1 to n do
for j:=1 to n do
read(f1,a[i,j]);
end;
function aaa(x:integer):boolean;
var i,j:integer;
ww:array[1..25]of integer;
aa:array[1..25,1..25]of integer;
begin
for i:=1 to n do ww[i]:=w[i];
for i:=1 to n do
for j:=1 to n do
aa[i,j]:=a[i,j];
for i:=1 to n do begin ww[x]:=aa[x,i]+ww[x];aa[x,i]:=0;aa[i,x]:=0;end;
for i:=1 to n do
begin
if ww[i]>ww[x] then begin aaa:=false;exit;end;
for j:=1 to n do
if ww[i]+aa[i,j]<=ww[x] then begin ww[i]:=ww[i]+aa[i,j];aa[i,j]:=0;aa[j,i]:=0; end
else begin ww[j]:=ww[j]+ww[x]-ww[i];ww[i]:=ww[x];aa[i,j]:=0;aa[j,i]:=0;end;
end;
aaa:=true;
end;
begin
assign(f1,'kleague.in');assign(f2,'kleague.out');
reset(f1);rewrite(f2);
read(f1,n);cs;
for ddd:=1 to n do if aaa(ddd) then write(f2,ddd,' ');
close(f1);close(f2);
end.