답안 #14409

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14409 2015-05-14T06:54:29 Z dodo3371 볼질 (OJUZ10_ballparade) C++14
0 / 100
29 ms 1720 KB
#include<stdio.h>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<string>
#include<iomanip>
#include<functional>
#include<stack>
#include<set>
#include<map>
#include<queue>
using namespace std;

int n;
int ballCnt;
bool isBase[3];
int res = 0;

int sol(int pos)
{
	if (pos >= 3)
		return 1;

	if (!isBase[pos])
	{
		isBase[pos] = true;
		return 0;
	}
	int ret = 0;
	if (isBase[pos])
		res += sol(pos + 1);

	return ret;
}
int main()
{
#ifdef _CONSOLE
	freopen("input.txt", "r", stdin);
#endif
	//////////////////////////////////////////////////
	scanf("%d", &n);
	while (n--)
	{
		int point;
		scanf("%d", &point);

		if (point == 1)
		{
			ballCnt++;
			if (ballCnt == 4)
			{
				res += sol(0);
				ballCnt = 0;
			}
		}
		else if (point == 2)
		{
			res += sol(0);
			ballCnt = 0;
		}
		else
		{
			ballCnt++;


			if (isBase[2])
			{
				res++;
				isBase[2] = false;
			}
			for (int i = 1; i >= 0; i--)
			{
				if (isBase[i])
				{
					isBase[i + 1] = true;
					isBase[i] = false;
				}
			}
			if (ballCnt == 4)
			{
				isBase[0] = true;
				ballCnt = 0;
			}
		}
		printf("%d %d %d %d\n", isBase[2], isBase[1], isBase[0], res);
	}
	printf("%d\n", res);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 1720 KB Output isn't correct
2 Incorrect 0 ms 1720 KB Output isn't correct
3 Incorrect 0 ms 1720 KB Output isn't correct
4 Incorrect 0 ms 1720 KB Output isn't correct
5 Incorrect 0 ms 1720 KB Output isn't correct
6 Incorrect 0 ms 1720 KB Output isn't correct
7 Incorrect 0 ms 1720 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 1720 KB Output isn't correct
2 Incorrect 13 ms 1720 KB Output isn't correct
3 Incorrect 23 ms 1720 KB Output isn't correct
4 Incorrect 0 ms 1720 KB Output isn't correct
5 Incorrect 0 ms 1720 KB Output isn't correct
6 Incorrect 0 ms 1720 KB Output isn't correct
7 Incorrect 2 ms 1720 KB Output isn't correct
8 Incorrect 14 ms 1720 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 1720 KB Output isn't correct
2 Incorrect 0 ms 1720 KB Output isn't correct
3 Incorrect 19 ms 1720 KB Output isn't correct
4 Incorrect 23 ms 1720 KB Output isn't correct
5 Incorrect 22 ms 1720 KB Output isn't correct
6 Incorrect 29 ms 1720 KB Output isn't correct
7 Incorrect 0 ms 1720 KB Output isn't correct
8 Incorrect 0 ms 1720 KB Output isn't correct
9 Incorrect 22 ms 1720 KB Output isn't correct
10 Incorrect 15 ms 1720 KB Output isn't correct
11 Incorrect 7 ms 1720 KB Output isn't correct
12 Incorrect 0 ms 1720 KB Output isn't correct
13 Incorrect 0 ms 1720 KB Output isn't correct
14 Incorrect 0 ms 1720 KB Output isn't correct
15 Incorrect 22 ms 1720 KB Output isn't correct