이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<cstring>
int p,x,s,i,j,b,a[4];
void f(int k)
{
if(k==4)s++;
else
{
if(a[k])f(k+1);
else a[k]=1;
}
}
main()
{
scanf("%d",&p);
for(i=0;i<p;i++)
{
scanf("%d",&x);
if(x==1)
{
b++;
if(b==4)f(1),b=0;
}
else if(x==2)
{
f(1),b=0;
}
else
{
for(j=3;j>=1;j--)
{
if(a[j])
{
if(j==3)s++,a[j]=0;
else
{
a[j]=0;
a[j+1]=1;
}
}
}
b++;
if(b==4)f(1),b=0;
}
}
printf("%d",s);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |