why i got WA?
Posted by
Neo 10 Mar 2003 15:25
const
mx=100000;
var
t:array[1..mx,1..2] of integer;
f:array[1..mx] of longint;
n:longint;
procedure init;
var i,j,k,min:longint;l:array[1..mx,1..2] of integer;
begin
readln(n);
for i:=1 to n do
begin
readln(t[i,1],t[i,2]);
f[i]:=1;
l[i,1]:=t[i,1];l[i,2]:=t[i,2];
end;
for i:=1 to n do
begin
min:=maxint;
for j:=1 to n do
if (l[j,1]<min) and (l[j,1]<>0) then begin min:=l
[j,1];k:=j;end;
t[i,1]:=l[k,1];t[i,2]:=l[k,2];
l[k,1]:=0;l[k,2]:=0;
end;
end;
procedure main;
var i,j:longint;max:integer;
begin
for i:=2 to n do
for j:=1 to n do
if t[j,1]>t[i,2] then f[i]:=f[i]+1;
max:=0;
for i:=1 to n do
if f[i]>max then max:=f[i];
writeln(max);
end;
begin
init;
main;
end.