#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;
}
}
}
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;
}
}
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 |
Correct |
0 ms |
1276 KB |
Output is 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 |
2 ms |
1276 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
2 |
Incorrect |
6 ms |
1276 KB |
Output isn't correct |
3 |
Correct |
0 ms |
1276 KB |
Output is correct |
4 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
7 |
Incorrect |
5 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 |
7 ms |
1276 KB |
Output isn't correct |
3 |
Incorrect |
6 ms |
1276 KB |
Output isn't correct |
4 |
Incorrect |
5 ms |
1276 KB |
Output isn't correct |
5 |
Incorrect |
3 ms |
1276 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
7 |
Incorrect |
3 ms |
1276 KB |
Output isn't correct |
8 |
Incorrect |
5 ms |
1276 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
11 |
Correct |
0 ms |
1276 KB |
Output is correct |
12 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
14 |
Incorrect |
3 ms |
1276 KB |
Output isn't correct |
15 |
Incorrect |
3 ms |
1276 KB |
Output isn't correct |