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