Submission #14176

# Submission time Handle Problem Language Result Execution time Memory
14176 2015-05-03T05:53:23 Z heohyun0703 볼질 (OJUZ10_ballparade) C++
100 / 100
7 ms 1084 KB
#include <stdio.h>
int n;
int base[4]={0,};
int ball_num;
int ans=0;
int main()
{
    int a,i;
    scanf("%d",&n);
    ball_num = 0;
    for(i=1; i<=n; i++){
        scanf("%d",&a);
        if(a == 1){
            ball_num++;
        }
        else if(a == 3){
            ball_num++;
            if(base[3] == 1){
                base[3] = 0;
                ans++;
            }
            if(base[2] == 1){
                base[2] = 0;
                base[3] = 1;
            }
            if(base[1] == 1){
                base[1] = 0;
                base[2] = 1;
            }
        }
        if(ball_num == 4 || a == 2){
            ball_num = 0;
            if(base[3] == 1 && base[2] == 1 && base[1] == 1){
                base[3] = 0;
                ans++;
            }
            if(base[2] == 1 && base[1] == 1){
                base[2] = 0;
                base[3] = 1;
            }
            if(base[1] == 1){
                base[1] = 0;
                base[2] = 1;
            }
            base[1] = 1;
        }
    }
    printf("%d\n",ans);
    return 0;
}
# Verdict Execution time Memory 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 0 ms 1084 KB Output is correct
7 Correct 3 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 3 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
8 Correct 3 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1084 KB Output is correct
2 Correct 5 ms 1084 KB Output is correct
3 Correct 4 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
5 Correct 4 ms 1084 KB Output is correct
6 Correct 0 ms 1084 KB Output is correct
7 Correct 0 ms 1084 KB Output is correct
8 Correct 0 ms 1084 KB Output is correct
9 Correct 5 ms 1084 KB Output is correct
10 Correct 0 ms 1084 KB Output is correct
11 Correct 7 ms 1084 KB Output is correct
12 Correct 6 ms 1084 KB Output is correct
13 Correct 3 ms 1084 KB Output is correct
14 Correct 7 ms 1084 KB Output is correct
15 Correct 0 ms 1084 KB Output is correct