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 n, bc, base[4], fail;
char yn[2][4]={"No","Yes"};
int main(){
int i;
scanf("%d", &n);
for(i=0; i<n; i++){
int a;
scanf("%d", &a);
if(a==3){ // wild pitch
bc++;
fail+=base[3];
base[3]=base[2], base[2]=base[1], base[1]=0;
if(bc==4)base[1]=1, bc=0; // BB
continue;
}
if(a==1)bc++;
if(a==2 || bc==4){ // base on balls
if(base[3] && base[2] && base[1])fail++;
else{
if(base[3] || (base[2] && base[1]))base[3]=1;
else base[3]=0;
if(base[2] || base[1])base[2]=1;
else base[2]=0;
base[1]=1;
}
bc=0;
}
}
printf("%d", fail);
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... |