|  | 
|  | 
| вернуться в форум | WA2 Help! program Ural1078;
 var
 ok:array[1..500,1..500]of boolean;
 x,y,ans:array[1..500]of longint;
 a,b,n,max:longint;
 
 function dfs(o,l:longint):boolean;
 
 var
 i:longint;
 u:boolean;
 
 begin
 u:=false;
 for i:=1 to n do
 if ok[o,i] then u:=u or dfs(i,l+1);
 if max<l then begin
 max:=l;
 u:=true;
 end;
 if u then ans[l]:=o;
 exit(u);
 end;
 
 begin
 readln(n);
 fillchar(ok,sizeof(ok),false);
 for a:=1 to n do
 readln(x[a],y[a]);
 for a:=1 to n do
 for b:=1 to n do
 if (x[a]<=x[b])and(y[b]<y[a]) then ok[a,b]:=true;
 max:=0;
 for a:=1 to n do
 if dfs(a,1) then ans[1]:=a;
 writeln(max);
 for a:=max downto 1 do
 write(ans[a],' ');
 end.
 
 What is wrong???
 | 
 | 
|