이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
int a[4];
int ball_count, ret;
void BALL(){
ball_count++;
if(ball_count == 4){
ball_count = 0;
if(a[1] && a[2] && a[3]){
ret++;
}
else if(a[1] && a[2]){
a[3] = 1;
}
else if(a[1]){
a[2] = 1;
}
a[1] = 1;
}
}
int main(){
int n;
scanf("%d",&n);
while (n--) {
int t;
scanf("%d",&t);
if(t == 1){
BALL();
}
else if(t == 2){
ball_count = 0;
if(a[1] && a[2] && a[3]){
ret++;
}
else if(a[1] && a[2]){
a[3] = 1;
}
else if(a[1]){
a[2] = 1;
}
a[1] = 1;
}
else{
if(a[3]) ret++;
a[3] = a[2];
a[2] = a[1];
a[1] = 0;
BALL();
}
}
printf("%d",ret);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |