# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
30698 | okaybody10 | 볼질 (OJUZ10_ballparade) | C++98 | 9 ms | 1116 KiB |
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 <memory.h>
int main()
{
int N;
scanf("%d",&N);
bool base[5];
memset(base,0,sizeof(base));
int ballcnt=0,error=0;
for(int i=0;i<N;i++)
{
int throwb;
scanf("%d",&throwb);
if(throwb==1)
{
ballcnt+=1;
if(ballcnt==4)
{
if(base[1] && base[2] && base[3])
{
base[3]=false;
error+=1;
}
if(base[1] && base[2])
{
base[3]=true;
}
if(base[1])
base[2]=true;
base[1]=true;
ballcnt=0;
}
}
else if(throwb==2)
{
if(base[1] && base[2] && base[3])
{
base[3]=false;
error+=1;
}
if(base[1] && base[2])
{
base[3]=true;
}
if(base[1])
base[2]=true;
base[1]=true;
ballcnt=0;
}
else
{
ballcnt+=1;
if(base[3])
{
base[3]=false;
error+=1;
}
if(base[2])
{
base[3]=true;
base[2]=false;
}
if(base[1])
{
base[1]=false;
base[2]=true;
}
if(ballcnt==4)
{
base[1]=true;
ballcnt=0;
}
}
}
printf("%d",error);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |