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

Pleas Help Why Compilation Erro on C?
Posted by Tbilsu_Irakli Khomeriki 19 Oct 2007 14:13
#include <stdio.h>

const int MX=500001;
int A[MX];
unsigned char P[MX][3];
int H[1001];
int n,o,i,q,w;
char c;
main()
{

    scanf("%d",&n);
    scanf("%c",&c);
    o=0;
    while (n>0)
    {
        scanf("%c%c",&c,&c);
        if(c=='U')
        {
            scanf("SH %d %d",&q,&w);
            if (o+1>=MX)
            {
                for (i=0; i<o; i++) if (A[i]<0) break;
            }
            else
            {
                o++;
                i=o;
            }
            A[i]=w;
            P[i][0]=H[q] / (256*256); H[q]%=(256*256);
            P[i][1]=H[q] / (256); H[q]%=256;
            P[i][2]=H[q];
            H[q]=i;
            scanf("%c",&c);
        }
        else
        {
            scanf("P %d",&q);
            printf("%ld\n",A[H[q]]);
            A[H[q]]=-1;
            H[q]=(int)P[H[q]][0]*256*256+(int)P[H[q]][1]*256+(int)P[H[q]][2];
            scanf("%c",&c);
        }
        n--;
    }
}
Re: Pleas Help Why Compilation Erro on C?
Posted by partisan (Andrey Korotkov) 7 Nov 2007 16:19
Hmm... Dev-C++ compile this code.
You may use sending result on your mail, and you'll get report about your problem (see FAQ)