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

What's wrong with my program?? WA at 10#
Posted by boats 6 Nov 2008 11:50
program t1220;
var i,k,m,n:longint;
    st:array[1..1000] of longint;
    a:array[0..100000] of longint;
    f:array[0..100000] of word;
    s:char;
begin
  readln(n);
  for i:=1 to n do
   begin
     read(s,s,s,s);
     if s='H' then
       begin
         readln(k,a[i]);
         f[i]:=st[k];
         st[k]:=i;
       end else
       begin
         readln(k);
         writeln(a[st[k]]);
         st[k]:=f[st[k]];
       end;
   end;
end.
Re: What's wrong with my program?? WA at 10#
Posted by Atik 17 Feb 2009 01:07
I think this is wrong in this program:
   f:array[0..100000] of word;
WORD type too small, but array[0..100000] of longword is too large... I've used this strange array:
  morethen50k:array[0..100000] of byte;

;)

Edited by author 17.02.2009 01:08

Edited by author 17.02.2009 01:08