Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

史上最垃圾代码

Posted by qqmsyz5200 at 2008-08-05 16:00:36 on Problem 2652
```#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:

User ID:
Title:

Content: