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