Submission #14107

# Submission time Handle Problem Language Result Execution time Memory
14107 2015-05-02T05:47:07 Z ggoh 볼질 (OJUZ10_ballparade) C++
22 / 100
7 ms 1084 KB
#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++;
					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
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 0 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
7 Correct 6 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1084 KB Output isn't correct
2 Incorrect 7 ms 1084 KB Output isn't correct
3 Incorrect 0 ms 1084 KB Output isn't correct
4 Incorrect 0 ms 1084 KB Output isn't correct
5 Incorrect 0 ms 1084 KB Output isn't correct
6 Correct 0 ms 1084 KB Output is correct
7 Incorrect 6 ms 1084 KB Output isn't correct
8 Incorrect 0 ms 1084 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1084 KB Output isn't correct
2 Incorrect 6 ms 1084 KB Output isn't correct
3 Incorrect 7 ms 1084 KB Output isn't correct
4 Incorrect 6 ms 1084 KB Output isn't correct
5 Incorrect 0 ms 1084 KB Output isn't correct
6 Incorrect 5 ms 1084 KB Output isn't correct
7 Incorrect 0 ms 1084 KB Output isn't correct
8 Incorrect 7 ms 1084 KB Output isn't correct
9 Incorrect 5 ms 1084 KB Output isn't correct
10 Incorrect 0 ms 1084 KB Output isn't correct
11 Incorrect 0 ms 1084 KB Output isn't correct
12 Correct 0 ms 1084 KB Output is correct
13 Incorrect 6 ms 1084 KB Output isn't correct
14 Incorrect 0 ms 1084 KB Output isn't correct
15 Correct 0 ms 1084 KB Output is correct