|
|
back to boardI not understand why WA #5!!! plz help {$N+} const coll=250000; var n,i,j:longint; m:array[0..coll] of double; procedure Go(li,ls:longint); var i,j:longint; x,y:double; begin i:=li; j:=ls; x:=m[(li+ls) div 2]; repeat while m[i]<x do inc(i); while m[j]>x do dec(j); if i<=j then begin x:=m[i]; m[i]:=m[j]; m[j]:=x; inc(i); dec(j); end; until i>j; if i<ls then Go(i,ls); if j>li then Go(li,j); end; begin readln(n); for i:=1 to n do readln(m[i]); Go(1,n); if n=1 then writeln(m[1]:1:1) else if n mod 2=1 then writeln(m[n div 2+1]:1:1) else writeln((m[n div 2]+m[n div 2+1])/2:1:1); end. help plz Re: I not understand why WA #5!!! plz help 1. Use writeln(x:0:1) instead of writeln(x:1:1) 2. You will get Memory Limit Exceeded. All troubles are memory related in this particular problem. |
|
|