이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
int n;
int base[4]={0,};
int ball_num;
int ans=0;
int main()
{
int a,i;
scanf("%d",&n);
ball_num = 0;
for(i=1; i<=n; i++){
scanf("%d",&a);
if(a == 1){
ball_num++;
}
else if(a == 3){
ball_num++;
if(base[3] == 1){
base[3] = 0;
ans++;
}
if(base[2] == 1){
base[2] = 0;
base[3] = 1;
}
if(base[1] == 1){
base[1] = 0;
base[2] = 1;
}
}
if(ball_num == 4 || a == 2){
ball_num = 0;
if(base[3] == 1 && base[2] == 1 && base[1] == 1){
base[3] = 0;
ans++;
}
if(base[2] == 1 && base[1] == 1){
base[2] = 0;
base[3] = 1;
}
if(base[1] == 1){
base[1] = 0;
base[2] = 1;
}
base[1] = 1;
}
}
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... |