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