|
|
вернуться в форумLinear Short Solve var b,a:array[0..100010]of longint; x,i,n:longint; begin readln(n); for i:=1 to n do begin readln(x); inc(a[x]); end; x:=0; for i:=0 to 5000 do while(a[i]>0)do begin inc(x); dec(a[i]); b[x]:=i; end; readln; readln(n); for i:=1 to n do begin read(x); writeln(b[x]); end; end. Edited by author 20.01.2010 18:28 Re: Linear Short Solve I think size of array "a" is too big(the range of values lies between 1 and 5000)..... ....and of array"b" too (max number of values is 100000 but not 1000010); Edited by author 06.04.2016 22:53 |
|
|