답안 #14592

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14592 2015-05-20T15:20:48 Z ioojh6654 볼질 (OJUZ10_ballparade) C++
100 / 100
7 ms 1276 KB
#include<stdio.h>
int t[50000], a[5];
int main()
{
	int n, i, ball=0, score=0;
	scanf("%d", &n);	

	for(i=1; i<=4; i++)a[i]=0;
	for(i=1; i<=n; i++)
	{	
		scanf("%d", &t[i]);
		if(t[i]==1)
		{
			ball++;
			if(ball>3)
			{
				ball=0;
				if(a[3]==1&&a[2]==1&&a[1]==1) score++;
				else if(a[3]==0&&a[2]==1&&a[1]==1)a[3]=1;
				else if((a[3]==0&&a[2]==0&&a[1]==1)||(a[3]==1&&a[2]==0&&a[1]==1))a[2]=1;
				else a[1]=1;
			}
		}
		else if(t[i]==2)
		{
			ball=0;
			if(a[3]==1&&a[2]==1&&a[1]==1)score++;
			else if(a[3]==0&&a[2]==1&&a[1]==1)a[3]=1;
			else if((a[3]==0&&a[2]==0&&a[1]==1)||(a[3]==1&&a[2]==0&&a[1]==1))a[2]=1;
			else a[1]=1;
		}
		else
		{
			ball++;
			if(a[3]==1)
			{
				score++;
				a[3]=0;
			}
			if(a[2]==1)
			{
				a[3]=1;
				a[2]=0;
			}
			if(a[1]==1)
			{
				a[2]=1;
				a[1]=0;
			}
			if(ball>3)
			{
				ball=0;
				a[1]=1;
			}
		}
	}
	printf("%d", score);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1276 KB Output is correct
2 Correct 5 ms 1276 KB Output is correct
3 Correct 0 ms 1276 KB Output is correct
4 Correct 0 ms 1276 KB Output is correct
5 Correct 0 ms 1276 KB Output is correct
6 Correct 0 ms 1276 KB Output is correct
7 Correct 1 ms 1276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1276 KB Output is correct
2 Correct 0 ms 1276 KB Output is correct
3 Correct 0 ms 1276 KB Output is correct
4 Correct 0 ms 1276 KB Output is correct
5 Correct 6 ms 1276 KB Output is correct
6 Correct 0 ms 1276 KB Output is correct
7 Correct 6 ms 1276 KB Output is correct
8 Correct 0 ms 1276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1276 KB Output is correct
2 Correct 0 ms 1276 KB Output is correct
3 Correct 0 ms 1276 KB Output is correct
4 Correct 7 ms 1276 KB Output is correct
5 Correct 6 ms 1276 KB Output is correct
6 Correct 0 ms 1276 KB Output is correct
7 Correct 0 ms 1276 KB Output is correct
8 Correct 0 ms 1276 KB Output is correct
9 Correct 0 ms 1276 KB Output is correct
10 Correct 0 ms 1276 KB Output is correct
11 Correct 6 ms 1276 KB Output is correct
12 Correct 6 ms 1276 KB Output is correct
13 Correct 4 ms 1276 KB Output is correct
14 Correct 4 ms 1276 KB Output is correct
15 Correct 0 ms 1276 KB Output is correct