ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1026. Questions and Answers

Why WA1???
Posted by sirenko.anas 16 Mar 2016 19:21
program z1026;
var n,k,i,j,nomer:integer;
    count:array[1..5000]of integer;
    a,rez:array[1..100000]of integer;
    z:array[1..100]of integer;
    s:string;
begin
     read(n);
     for i:=1 to n do read(a[i]);
     read(s);
     read(k);

     for i:=1 to 5000 do count[i]:=0;
     for i:=1 to n do inc(count[a[i]]);
     nomer:=1;
     for i:=1 to 5000 do
         for j:=1 to count[i] do begin
             rez[nomer]:=i;
             inc(nomer);
         end;

     for i:=1 to k do read(z[i]);
     for i:=1 to k do writeln(rez[z[i]]);
end.

Answer for test1 is
  121
  121
  7
  123