Submission #14158

# Submission time Handle Problem Language Result Execution time Memory
14158 2015-05-02T19:07:49 Z pichulia 볼질 (OJUZ10_ballparade) C++
100 / 100
7 ms 1472 KB
#include<stdio.h>
int cnt;
int n;
int a[100000];
int b[9];
int res;
void go()
{
	b[0]++;
	if(b[0]==2)
	{
		b[0]=1;
		b[1]++;
		if(b[1]==2)
		{
			b[1]=1;
			b[2]++;
			if(b[2]==2)
			{
				b[2]=1;
				res++;
			}
		}
	}
}
int main()
{
	int i, j, k;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	res=0;
	for(i=0;i<n;i++)
	{
		if(a[i]&1)cnt++;
		if(a[i]==3){
			res += b[2];
			b[2]=b[1];
			b[1]=b[0];
			b[0]=0;
		}
		if(a[i]==2 || cnt==4)
		{
			cnt=0;
			go();
		}
	}
	printf("%d\n",res);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1472 KB Output is correct
2 Correct 0 ms 1472 KB Output is correct
3 Correct 4 ms 1472 KB Output is correct
4 Correct 0 ms 1472 KB Output is correct
5 Correct 0 ms 1472 KB Output is correct
6 Correct 0 ms 1472 KB Output is correct
7 Correct 0 ms 1472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1472 KB Output is correct
2 Correct 0 ms 1472 KB Output is correct
3 Correct 0 ms 1472 KB Output is correct
4 Correct 0 ms 1472 KB Output is correct
5 Correct 0 ms 1472 KB Output is correct
6 Correct 0 ms 1472 KB Output is correct
7 Correct 5 ms 1472 KB Output is correct
8 Correct 3 ms 1472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1472 KB Output is correct
2 Correct 0 ms 1472 KB Output is correct
3 Correct 7 ms 1472 KB Output is correct
4 Correct 6 ms 1472 KB Output is correct
5 Correct 6 ms 1472 KB Output is correct
6 Correct 5 ms 1472 KB Output is correct
7 Correct 0 ms 1472 KB Output is correct
8 Correct 0 ms 1472 KB Output is correct
9 Correct 4 ms 1472 KB Output is correct
10 Correct 0 ms 1472 KB Output is correct
11 Correct 0 ms 1472 KB Output is correct
12 Correct 4 ms 1472 KB Output is correct
13 Correct 0 ms 1472 KB Output is correct
14 Correct 0 ms 1472 KB Output is correct
15 Correct 5 ms 1472 KB Output is correct