답안 #13964

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
13964 2015-04-24T16:32:09 Z gs14004 볼질 (OJUZ10_ballparade) C++14
100 / 100
7 ms 1084 KB
#include <cstdio>

int a[4];
int ball_count, ret;

void BALL(){
    ball_count++;
    if(ball_count == 4){
        ball_count = 0;
        if(a[1] && a[2] && a[3]){
            ret++;
        }
        else if(a[1] && a[2]){
            a[3] = 1;
        }
        else if(a[1]){
            a[2] = 1;
        }
        a[1] = 1;
    }
}
int main(){
    int n;
    scanf("%d",&n);
    while (n--) {
        int t;
        scanf("%d",&t);
        if(t == 1){
            BALL();
        }
        else if(t == 2){
            ball_count = 0;
            if(a[1] && a[2] && a[3]){
                ret++;
            }
            else if(a[1] && a[2]){
                a[3] = 1;
            }
            else if(a[1]){
                a[2] = 1;
            }
            a[1] = 1;
        }
        else{
            if(a[3]) ret++;
            a[3] = a[2];
            a[2] = a[1];
            a[1] = 0;
            BALL();
        }
    }
    printf("%d",ret);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 3 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 Correct 0 ms 1084 KB Output is correct
3 Correct 3 ms 1084 KB Output is correct
4 Correct 3 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 0 ms 1084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1084 KB Output is correct
2 Correct 4 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 6 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 6 ms 1084 KB Output is correct
9 Correct 7 ms 1084 KB Output is correct
10 Correct 6 ms 1084 KB Output is correct
11 Correct 0 ms 1084 KB Output is correct
12 Correct 0 ms 1084 KB Output is correct
13 Correct 0 ms 1084 KB Output is correct
14 Correct 2 ms 1084 KB Output is correct
15 Correct 5 ms 1084 KB Output is correct