This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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... |