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<cstdio>
int juja[4];
int ball_count;
int main()
{
int n,i,now,score=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&now);
switch(now)
{
case 1:
ball_count++;
if(ball_count==4)
{
ball_count=0;
if(juja[3]==1 && juja[2]==1 && juja[1]==1)
score++;
else if(juja[2]==1 && juja[1]==1)
juja[3]=1;
else if(juja[1]==1)
juja[2]=1;
else juja[1]=1;
}
break;
case 2:
ball_count=0;
if(juja[3]==1 && juja[2]==1 && juja[1]==1)
score++;
else if(juja[2]==1 && juja[1]==1)
juja[3]=1;
else if(juja[1]==1)
juja[2]=1;
else juja[1]=1;
break;
case 3:
ball_count++;
if(juja[3]==1) juja[3]=0,score++;
if(juja[2]==1) juja[3]=1,juja[2]=0;
if(juja[1]==1) juja[2]=1,juja[1]=0;
if(ball_count==4) ball_count=0,juja[1]=1;
break;
}
}
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... |