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 1306. Sequence Median

WA #7
Posted by TinyJanssen 19 Mar 2013 04:52
What is the trick of problem 7?
I tried a file of 250000 numbers 2^31-1 and got the answer 2147483647.0
So this is right.
I tried 1 0 and got 0.0
There was no TLE but a wrong answer.
Re: WA #7
Posted by TinyJanssen 22 Mar 2013 20:42
This is a piece of my code
Something is still wrong

CreatePQueue(a);              // creates a priority queue
readln(N);
for i:=1 to (N div 2) + 1 do
begin
  readln(j);
  PriorityEnq(a,j);           //push the number
end;
for i:= (N div 2) + 2 to N do
begin
  readln(j);
  PriorityEnq(a,j);          //push the number
  PriorityDeq(a,k);          //pop the greatest
end;
if odd(N) then
begin
  PriorityDeq(a,k);         //pop the gratest
  s:=k;
  writeln(s:0:1);
end
else
begin
  PriorityDeq(a,l);
  PriorityDeq(a,k);
  s:=l+k;
  writeln(s/2:0:1);
end;