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