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 1037. Memory Management

W5!!!WHY!!!
Posted by zsyzzsx2 25 Jan 2010 17:50
var
  ncb:array[1..30000]of boolean;
  nct:array[1..30000]of longint;
  i,j,k,n,t:longint;
  c:char;
begin
  repeat
    read(t,c);read(c);
    if c='.'
    then begin
           readln(n);
           if ncb[n]
           then begin
                  if t-nct[n]<600
                  then begin
                         writeln('+');
                         nct[n]:=t;
                       end
                  else writeln('-');
                end
           else writeln('-');
         end
    else begin
           i:=1;
           while (t-nct[i]<600) and (ncb[i]=true) do inc(i);
           ncb[i]:=true;
           nct[i]:=t;
           writeln(i);
         end;
  until eof;
end.
Re: W5!!!WHY!!!
Posted by Alez 3 Dec 2011 06:50
there is 30001 number of box in this case...