4 6 7 测试点为什么过不去。。。。。。

program p1_1(input,output);
var
n,i1,i2,o,q:longint;
a:array [1..5000,1..5000] of longint;
sum,b:array [1..5000] of longint;
procedure f;
begin
o:=sum[i1];
sum[i1]:=sum[i2];
sum[i2]:=o;
q:=b[i1];
b[i1]:=b[i2];
b[i2]:=q;
end;
begin
readln(n);
q:=1;
for i1:=1 to n do begin
for i2:=1 to 3 do begin
read(a[i1,i2]);
if a[i1,i2]<=100 then begin
sum[i1]:=sum[i1]+a[i1,i2];
b[i1]:=q;
end;
end;
inc(q);
end;
for i1:=1 to n-1 do
for i2:=i1+1 to n do begin
if sum[i2]>sum[i1] then f
else if (sum[i1]=sum[i2]) and (a[i1,1]<a[i2,1]) then f
else if (sum[i1]=sum[i2]) and (a[i1,1]<a[i2,1]) and (b[i1]>b[i2]) then f;
end;
for i1:=1 to 5 do if sum[i1]<>0 then writeln(b[i1],' ',sum[i1]);
end.

0 条评论

目前还没有评论...

信息

ID
1398
难度
4
分类
其他 | 排序 点击显示
标签
递交数
6447
已通过
2665
通过率
41%
被复制
22
上传者