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

Common Board

Why my program is "Memory Limit exceed",I think i just use no more than 200K?
Posted by Cain 8 Jun 2001 19:57
const
  maxN = 30000;
  interval = 600;

var
  block : array[0..maxn]of longint;
  i,time,no : longint;
  v : integer;
  s,_s : string;

begin
  while not eof do begin
    readln(s);
    if pos('+',s)>0 then begin
      delete(s,pos('+',s),1);
      while s[length(s)]=' ' do delete(s,length(s),1);
      val(s,time,v);
      for i:=1 to maxn do
        if (block[i]=0)or(time-block[i]>=600) then break;
      block[i]:=time;
      writeln(i);
    end else begin
      i:=pos('.',s);
      _s:=copy(s,1,i-1);
      delete(s,1,i);
      while s[length(s)]=' ' do delete(s,length(s),1);
      while _s[length(_s)]=' ' do delete(_s,length(_s),1);
      val(_s,time,v);
      val(s,no,v);
      if (time-block[no]>=600)or(block[no]=0) then writeln
('-')
      else begin
        block[no]:=time;
        writeln('+');
      end;
    end;
  end;
end.