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>
#include <algorithm>
using namespace std;
int n,score,base[4];
void bob (void)
{
if(base[0]+base[1]+base[2]==3)//홈인
score++;
base[2]=max(base[2],(base[1]+base[0])/2);
base[1]=max(base[1],base[0]);
return ;
}
void bob2 (void)
{
if(base[2]==1)
score++;
base[2]=base[1];
base[1]=base[0];
base[0]=0;
return ;
}
int main (void)
{
int i,t,ball=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&t);
if(t==1)
ball++;
else if(t==2){
bob();
base[0]=1;
ball=0;
}
else{
bob2();
ball++;
}
if(ball==4){
bob();
base[0]=1;
ball=0;
}
}
printf("%d\n",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... |