#include <stdio.h>
int ball[50001];
int base[5];
int main()
{
int n;
scanf("%d", &n);
int i, j;
for (i = 1; i <= n; i++)
scanf("%d", &ball[i]);
int score = 0;
int count = 0;
for (i = 1; i <= n; i++)
{
if (ball[i] == 2)
{
for (j = 3; j >= 3; j--)
{
if (base[j] == 1)
{
base[j + 1] = 1;
base[j] = 0;
}
}
count = 0;
}
if (ball[i] == 1 || ball[i] == 2)
count += 1;
if (count == 4)
{
for (j = 1; j <= 4; j++)
{
if (base[4] == 1)
break;
if (base[j] == 1)
{
base[j] = 2;
if (base[j - 1] == 2)
base[j - 1] = 1;
}
else
{
if (base[j - 1] == 2)
{
base[j] = 1;
base[j - 1] = 1;
}
break;
}
}
count = 0;
base[1] = 1;
}
else if (ball[i] == 3)
{
for (j = 3; j >= 1; j--)
{
if (base[j] == 1)
{
base[j + 1] = 1;
base[j] = 0;
}
}
}
if (base[4] == 1)
{
score += 1;
base[4] = 0;
}
}
printf("%d", score);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
3 |
Incorrect |
4 ms |
1276 KB |
Output isn't correct |
4 |
Correct |
0 ms |
1276 KB |
Output is correct |
5 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
7 |
Correct |
0 ms |
1276 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
1276 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
5 |
Correct |
0 ms |
1276 KB |
Output is correct |
6 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
7 |
Incorrect |
7 ms |
1276 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
1276 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
4 |
Incorrect |
6 ms |
1276 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
6 |
Incorrect |
7 ms |
1276 KB |
Output isn't correct |
7 |
Incorrect |
6 ms |
1276 KB |
Output isn't correct |
8 |
Incorrect |
7 ms |
1276 KB |
Output isn't correct |
9 |
Incorrect |
6 ms |
1276 KB |
Output isn't correct |
10 |
Incorrect |
7 ms |
1276 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
1276 KB |
Output isn't correct |
12 |
Correct |
0 ms |
1276 KB |
Output is correct |
13 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
15 |
Incorrect |
6 ms |
1276 KB |
Output isn't correct |