#include <stdio.h>
int ball[4],base[4];
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int n,a,i,s=0;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d",&a);
ball[a]++;
if(ball[1]==4||a==2){
if(base[3]&&base[2]&&base[1])s++;
else if(base[2]&&base[1]) base[3]=1;
else if(base[3]&&base[1]||base[1]) base[2]=1;
base[1]=1;
ball[1]=0;
}
if(a==3){
ball[1]++;
if(base[3])s++,base[3]=0;
if(base[2])base[3]=1,base[2]=0;
if(base[1])base[2]=1,base[1]=0;
if(ball[1]==4)base[1]=1;
}
//printf("%d %d %d\n%d %d %d\n%d\n",ball[1],ball[2],ball[3],base[1],base[2],base[3],s);
}
printf("%d",s);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
2 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
3 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
4 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
5 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
6 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
7 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
2 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
3 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
4 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
5 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
6 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
7 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
8 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
2 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
3 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
4 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
5 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
6 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
7 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
8 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
9 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
10 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
11 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
12 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
13 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
14 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |
15 |
Runtime error |
0 ms |
1076 KB |
open (syscall #2) was called by the program (disallowed syscall) |