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<stdio.h>
int R[5];
int main(){
int N, i, j, Ball=0, a;
scanf("%d", &N);
for(i=1; i<=N; i++){
scanf("%d", &a);
if(a==1) Ball++;
if(a==3){
Ball++;
for(j=3; j>=1; j--){
if(R[j]) R[j+1]++;
R[j]=0;
}
}
if(a==2 || Ball==4){
Ball=0;
if(R[1]==1 && R[2]==1 && R[3]==1) R[4]++;
else if(R[1]==1 && R[2]==1) R[3]=1;
else if(R[1]==1) R[2]=1;
else R[1]=1;
}
}
printf("%d", R[4]);
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... |