이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
int n;
int ans;
int buf;
int ballcnt;
bool j1,j2,j3;
int main()
{
scanf("%d",&n);
for(;n--;){
scanf("%d",&buf);
if(buf==1){
//puts("ball");
++ballcnt;
if(ballcnt==4){
//puts("");
if(j1){
if(j2){
if(j3){
++ans; j3=false;
}
j3=true; j2=false;
}
j2=true; j1=false;
}
j1=true;
ballcnt=0;
}
} else if(buf==2){
//puts("beanball\n");
if(j1){
if(j2){
if(j3){
++ans; j3=false;
}
j3=true; j2=false;
}
j2=true; j1=false;
}
ballcnt=0;
j1=true;
} else {
//puts("asdf");
++ballcnt;
ans+=j3; j3=false;
j3=j2; j2=false;
j2=j1; j1=false;
if(ballcnt==4) j1=true, ballcnt=0;
}
//printf("Current state %d %d %d\n",j1,j2,j3);
}
printf("%d\n",ans);
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |