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 bace[5],a[50001],bc=0,i,j,n,score=0;
int main(void)
{
FILE *in,*out;
in=stdin;//fopen("input.txt","r");
out=fopen("output.txt","w");
fscanf(in,"%d",&n);
for(i=0;i<n;i++){
// printf("%d %d %d %d\n",bace[1],bace[2],bace[3],bc);
fscanf(in,"%d",&a[i]);
if(a[i]==3){
if(bace[3]==1){
score++;
bace[3]=0;
}
bace[3]=bace[2];
bace[2]=bace[1];
bace[1]=0;
}
if(a[i]==1 || a[i]==3)
bc++;
if(bc==4 ||a[i]==2){
bc=0;
if(bace[1]==1 && bace[2]==1 && bace[3]==1)
score++;
else if(bace[1]==1 && bace[2]==1)
bace[3]=1;
else if(bace[1]==1)
bace[2]=1;
else bace[1]=1;
}
}
printf("%d",score);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |