답안 #329473

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
329473 2020-11-21T09:32:35 Z mihai145 Mini tetris (IOI16_tetris) C++14
100 / 100
3 ms 384 KB
#include "tetris.h"

int state[5];

void init(int n) {
    state[1] = 0;
    state[2] = 0;
    state[3] = 0;
}

bool IsState(int a, int b, int c) {
    if(state[1] != a)
        return false;

    if(state[2] != b)
        return false;

    if(state[3] != c)
        return false;

    return true;
}

void SetState(int a, int b, int c) {
    state[1] = a;
    state[2] = b;
    state[3] = c;
}

int position, rotation;

void new_figure(int figure_type) {

    if(figure_type == 1) {
        position = 0;
        rotation = 0;
        return ;
    }

    if(figure_type == 2) {
        if(IsState(0, 0, 0)) {
            position = 0;
            rotation = 0;
            SetState(1, 1, 0);
        } else if(IsState(1, 1, 0)) {
            position = 2;
            rotation = 1;
            SetState(0, 0, 1);
        } else if(IsState(2, 1, 0)) {
            position = 1;
            rotation = 0;
            SetState(1, 1, 0);
        } else if(IsState(0, 0, 1)) {
            position = 0;
            rotation = 0;
            SetState(0, 0, 0);
        } else if(IsState(0, 1, 1)) {
            position = 0;
            rotation = 1;
            SetState(1, 0, 0);
        } else if(IsState(1, 0, 0)) {
            position = 1;
            rotation = 0;
            SetState(0, 0, 0);
        }
        return ;
    }

    if(figure_type == 3) {
        if(IsState(0, 0, 0)) {
            position = 0;
            rotation = 0;
            SetState(2, 1, 0);
        } else if(IsState(1, 1, 0)) {
            position = 1;
            rotation = 2;
            SetState(0, 1, 1);
        } else if(IsState(2, 1, 0)) {
            position = 1;
            rotation = 2;
            SetState(0, 0, 0);
        } else if(IsState(0, 0, 1)) {
            position = 0;
            rotation = 0;
            SetState(1, 0, 0);
        } else if(IsState(1, 0, 0)) {
            position = 1;
            rotation = 1;
            SetState(0, 0, 1);
        } else if(IsState(0, 1, 1)) {
            position = 0;
            rotation = 3;
            SetState(1, 1, 0);
        }

        return ;
    }
}

int get_position() {
    return position;
}

int get_rotation() {
    return rotation;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Win!
2 Correct 1 ms 364 KB Win!
3 Correct 1 ms 364 KB Win!
4 Correct 1 ms 256 KB Win!
5 Correct 1 ms 256 KB Win!
6 Correct 1 ms 364 KB Win!
7 Correct 2 ms 364 KB Win!
8 Correct 3 ms 364 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Win!
2 Correct 1 ms 364 KB Win!
3 Correct 1 ms 364 KB Win!
4 Correct 1 ms 384 KB Win!
5 Correct 1 ms 364 KB Win!
6 Correct 1 ms 364 KB Win!
7 Correct 2 ms 364 KB Win!
8 Correct 3 ms 364 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Win!
2 Correct 1 ms 364 KB Win!
3 Correct 1 ms 364 KB Win!
4 Correct 1 ms 256 KB Win!
5 Correct 1 ms 256 KB Win!
6 Correct 1 ms 364 KB Win!
7 Correct 2 ms 364 KB Win!
8 Correct 3 ms 364 KB Win!
9 Correct 1 ms 364 KB Win!
10 Correct 1 ms 364 KB Win!
11 Correct 1 ms 364 KB Win!
12 Correct 1 ms 384 KB Win!
13 Correct 1 ms 364 KB Win!
14 Correct 1 ms 364 KB Win!
15 Correct 2 ms 364 KB Win!
16 Correct 3 ms 364 KB Win!
17 Correct 1 ms 364 KB Win!
18 Correct 1 ms 364 KB Win!
19 Correct 1 ms 364 KB Win!
20 Correct 1 ms 364 KB Win!
21 Correct 1 ms 364 KB Win!
22 Correct 1 ms 364 KB Win!
23 Correct 2 ms 364 KB Win!
24 Correct 3 ms 364 KB Win!
25 Correct 3 ms 364 KB Win!
26 Correct 3 ms 364 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Win!
2 Correct 1 ms 364 KB Win!
3 Correct 1 ms 364 KB Win!
4 Correct 1 ms 364 KB Win!
5 Correct 1 ms 364 KB Win!
6 Correct 1 ms 364 KB Win!
7 Correct 2 ms 364 KB Win!
8 Correct 3 ms 364 KB Win!
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Win!
2 Correct 1 ms 364 KB Win!
3 Correct 1 ms 364 KB Win!
4 Correct 1 ms 256 KB Win!
5 Correct 1 ms 256 KB Win!
6 Correct 1 ms 364 KB Win!
7 Correct 2 ms 364 KB Win!
8 Correct 3 ms 364 KB Win!
9 Correct 1 ms 364 KB Win!
10 Correct 1 ms 364 KB Win!
11 Correct 1 ms 364 KB Win!
12 Correct 1 ms 384 KB Win!
13 Correct 1 ms 364 KB Win!
14 Correct 1 ms 364 KB Win!
15 Correct 2 ms 364 KB Win!
16 Correct 3 ms 364 KB Win!
17 Correct 1 ms 364 KB Win!
18 Correct 1 ms 364 KB Win!
19 Correct 1 ms 364 KB Win!
20 Correct 1 ms 364 KB Win!
21 Correct 1 ms 364 KB Win!
22 Correct 1 ms 364 KB Win!
23 Correct 2 ms 364 KB Win!
24 Correct 3 ms 364 KB Win!
25 Correct 3 ms 364 KB Win!
26 Correct 3 ms 364 KB Win!
27 Correct 1 ms 364 KB Win!
28 Correct 1 ms 364 KB Win!
29 Correct 1 ms 364 KB Win!
30 Correct 1 ms 364 KB Win!
31 Correct 1 ms 364 KB Win!
32 Correct 1 ms 364 KB Win!
33 Correct 2 ms 364 KB Win!
34 Correct 3 ms 364 KB Win!
35 Correct 1 ms 364 KB Win!
36 Correct 1 ms 364 KB Win!
37 Correct 1 ms 364 KB Win!
38 Correct 1 ms 364 KB Win!
39 Correct 1 ms 364 KB Win!
40 Correct 1 ms 364 KB Win!
41 Correct 2 ms 364 KB Win!
42 Correct 3 ms 364 KB Win!
43 Correct 3 ms 364 KB Win!
44 Correct 3 ms 384 KB Win!
45 Correct 3 ms 364 KB Win!