#include <stdio.h>
int run[4]={},sum,ball;
void runover()
{
if(run[3]==1)
sum++;
run[3]=run[2];
run[2]=run[1];
run[1]=0;
}
int main()
{
int n,t,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&t);
if(t==1)
{
ball++;
if(ball==4)
{
ball=0;
runover();
run[1]=1;
}
}
if(t==3)
{
ball++;
runover();
if(ball==4)
{
ball=0;
run[1]=1;
}
}
if(t==2)
{
ball=0;
runover();
run[1]=1;
}
}
printf("%d",sum);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
2 ms |
1084 KB |
Output is correct |
3 |
Correct |
5 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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 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 |
1 ms |
1084 KB |
Output is correct |
5 |
Correct |
0 ms |
1084 KB |
Output is correct |
6 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
7 |
Correct |
0 ms |
1084 KB |
Output is correct |
8 |
Correct |
0 ms |
1084 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
2 |
Correct |
0 ms |
1084 KB |
Output is correct |
3 |
Correct |
3 ms |
1084 KB |
Output is correct |
4 |
Correct |
7 ms |
1084 KB |
Output is correct |
5 |
Correct |
7 ms |
1084 KB |
Output is correct |
6 |
Correct |
0 ms |
1084 KB |
Output is correct |
7 |
Incorrect |
0 ms |
1084 KB |
Output isn't correct |
8 |
Incorrect |
3 ms |
1084 KB |
Output isn't correct |
9 |
Correct |
4 ms |
1084 KB |
Output is correct |
10 |
Correct |
5 ms |
1084 KB |
Output is correct |
11 |
Correct |
0 ms |
1084 KB |
Output is correct |
12 |
Incorrect |
5 ms |
1084 KB |
Output isn't correct |
13 |
Correct |
0 ms |
1084 KB |
Output is correct |
14 |
Incorrect |
7 ms |
1084 KB |
Output isn't correct |
15 |
Incorrect |
5 ms |
1084 KB |
Output isn't correct |