This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |