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

Why I got WA??
Posted by a 14 Sep 2003 14:37
const t=600;
      n=30000;
var a:array[1..30000]of word;
    time,point,address:word;ch:char;
begin
     assign(input,'1.in');
     reset(input);
     assign(output,'1.out');
     rewrite(output);
     fillchar(a,sizeof(a),0);
     while not eof do begin
           read(time);read(ch);read(ch);
           if ch='+' then
              begin
              point:=0;
              repeat
                    inc(point);
                    if (a[point]<=time) then break;
                    until false;
                    a[point]:=time+600;
                    writeln(point);
              end;
           if ch='.' then
              begin
                   read(address);
                   if a[address]<=time then writeln('-')
                                       else begin
                                            writeln('+');
                                            a[address]:=time+600;
                                            end;
              end;
     end;
     close(input);close(output);
end.