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