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 |
史上最垃圾代码#include <stdio.h> #define ch2 ch>0?0:1 void main(){ int a[4][10005],n,t,m,co,now,ch,i,j,b,c[2],d[2]; char s[10]; scanf("%d",&co); while(co--){ scanf("%d %d %d",&n,&t,&m); for(i=c[0]=c[1]=1;i<=m;i++){ scanf("%d %s",&b,s); a[2][i]=a[3][i]=s[0]>'l'?1:0; a[a[2][i]][c[a[2][i]]++]=b; } for(d[1]=d[0]=1,ch=now=0;d[1]+d[0]<=m+1;){ if(a[ch][d[ch]]>now &&a[ch2][d[ch2]]<=now){ now+=t; ch=ch2; } else if((a[ch][d[ch]]>a[ch2][d[ch2]] ||d[ch]>=c[ch]) &&a[ch2][d[ch2]]>now){ now=a[ch2][d[ch2]]; now+=t; ch=ch2; } now=now<a[ch][d[ch]]?a[ch][d[ch]]:now; for(j=0;j<n&&a[ch][d[ch]+j]<=now&&d[ch]+j<c[ch];j++){ a[ch][d[ch]+j]=now+t; } d[ch]+=j; now+=t;ch=ch2; } for(i=d[1]=d[0]=1;i<=m;i++){ printf("%d\n",a[a[2][i]][d[a[2][i]]++]); } putchar(10); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator