Submission #1357595

#TimeUsernameProblemLanguageResultExecution timeMemory
1357595yogesh_saneMini tetris (IOI16_tetris)C++20
100 / 100
1 ms344 KiB
int state = 0; // The current "profile" of the board
int last_pos, last_rot;

void init(int n) { 
    state = 0; 
}

void new_figure(int type) {
    if (type == 1) {
        last_pos = 0; last_rot = 0;
        // state remains the same
    } 
    else if (type == 2) {
        // Based on your States 0-5
        int pos[] = {0, 1, 2, 0, 0, 1};
        int rot[] = {0, 0, 1, 0, 1, 0};
        int next_state[] = {2, 0, 3, 0, 1, 2};
        
        last_pos = pos[state];
        last_rot = rot[state];
        state = next_state[state];
    } 
    else { // Type 3
        int pos[] = {0, 1, 1, 0, 0, 1};
        int rot[] = {0, 1, 2, 0, 3, 2};
        int next_state[] = {5, 3, 4, 1, 2, 0};
        
        last_pos = pos[state];
        last_rot = rot[state];
        state = next_state[state];
    }
}

int get_position() { return last_pos; }
int get_rotation() { return last_rot; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...