Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
别的oj能过,为什么poj就RE了?#include<stdio.h> #include<string.h> #include<memory.h> #define in "ENQUEUE" #define out "DEQUEUE" #define stop "STOP" int f[100005]; int q[1005]; int st[1005],en[1005]; int head,tail; int team[1005][1005]; int p[1005]; bool b[1005]; int m,i,n,j,k,t,temp; char str[200]; int main() { scanf("%d",&n); t=0; while (n>0) { t++; printf("Scenario #%d\n",t); head=1001; tail=0; for (i=0;i<=1004;i++) st[i]=1001; memset(en,0,sizeof(en)); memset(team,0,sizeof(team)); memset(q,0,sizeof(q)); memset(b,0,sizeof(b)); memset(f,0,sizeof(f)); for (i=1;i<=n;i++) { scanf("%d",&m); for (j=1;j<=m;j++) { scanf("%d",&k); f[k]=i; } } scanf("%s",&str); while (strcmp(str,stop)!=0) { if (strcmp(str,in)==0) { scanf("%d",&k); if (b[f[k]]) { st[f[k]]++; if (st[f[k]]==1002) st[f[k]]=0; team[f[k]][st[f[k]]]=k; } else { b[f[k]]=1; head++; if (head==1002) head=0; q[head]=f[k]; st[f[k]]++; if (st[f[k]]==1002) st[f[k]]=0; team[f[k]][st[f[k]]]=k; } } if (strcmp(str,out)==0) { temp=team[q[tail]][en[q[tail]]]; printf("%d\n",temp); en[q[tail]]++; if (en[q[tail]]==st[q[tail]]+1) { b[q[tail]]=0; tail++; if (tail==1002) tail=0; } if (en[q[tail]]==1002) en[q[tail]]=0; } scanf("%s",&str); } scanf("%d",&n); printf("\n"); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator