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 a[4]={1},ans,s;
int main(){
int i,n,k;
scanf("%d",&n);
for(;n--;){
scanf("%d",&k);
if(k==1)++s;
if(k==3)ans+=a[3],a[3]=a[2],a[2]=a[1],a[1]=0,++s;
if(k==2||s>3){
if(a[1]){
if(a[2]){
if(a[3])++ans;
a[3]=1;
}
a[2]=1;
}
a[1]=1;
s=0;
}
}
printf("%d",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... |