#include <stdio.h>
int bace[5],a[50001],bc=0,i,j,n,score=0;
int main(void)
{
FILE *in,*out;
in=stdin;//fopen("input.txt","r");
out=fopen("output.txt","w");
fscanf(in,"%d",&n);
for(i=0;i<n;i++){
// printf("%d %d %d %d\n",bace[1],bace[2],bace[3],bc);
fscanf(in,"%d",&a[i]);
if(a[i]==3){
if(bace[3]==1){
score++;
bace[3]=0;
}
bace[3]=bace[2];
bace[2]=bace[1];
bace[1]=0;
}
if(a[i]==1 || a[i]==3)
bc++;
if(bc==4 ||a[i]==2){
bc=0;
if(bace[1]==1 && bace[2]==1 && bace[3]==1)
score++;
else if(bace[1]==1 && bace[2]==1)
bace[3]=1;
else if(bace[1]==1)
bace[2]=1;
else bace[1]=1;
}
}
printf("%d",score);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
2 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
3 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
4 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
5 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
6 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
7 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
2 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
3 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
4 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
5 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
6 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
7 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
8 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
2 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
3 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
4 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
5 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
6 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
7 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
8 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
9 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
10 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
11 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
12 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
13 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
14 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |
15 |
Runtime error |
0 ms |
1268 KB |
open (syscall #2) was called by the program (disallowed syscall) |