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 1220. Stacks

help me!!!
Posted by Giorgi Saghinadze (Tbilisi SU) 9 Nov 2006 16:03
I have WA 10, but I can't find my mistake, it seems that my program works very well :(
help me please

var
a : array[0..100005] of integer;
b : array[0..100005] of word;
c : array[0..1005] of integer;
x,y,i,m,n,d : integer;
cc,p : char;
begin
  assign(input,'input.txt'); reset(input);
  assign(output,'output.txt'); rewrite(output);
    readln(n); m := 0; i := 0;
    while i < n do
    begin
      read(cc);
      d := 0;
      while (not (cc in ['A'..'Z'])) do
      begin
        if EOLN then
        begin
         d := 1;
         break;
        end;
        read(cc);
      end;
      if d = 1 then begin readln;continue; end;




      if cc <> 'P' then
      begin
        readln;
        continue;
      end;
            inc(i);
      read(cc);

      p := cc;
      while p in ['P','U','S','H','O'] do read(p);

      if cc = 'U' then
      begin
        readln(x,y);
        inc(m);
        a[m] := y;
        b[m] := c[x];
        c[x] := m;

      end else
      if cc = 'O' then
      begin
        readln(x);
        if c[x] <> 0 then begin
        writeln(a[c[x]]);
        c[x] := b[c[x]];     end;
      end;
    end;
  close(input); close(output);
end.
Re: help me!!!
Posted by Giorgi Saghinadze (Tbilisi SU) 9 Nov 2006 20:04
nobody wants to help me?
Re: help me!!!
Posted by [SPbSU ITMO] WiNGeR 10 Nov 2006 01:22
100000>32768, b[] may overflow (word)