Submission #329473

#TimeUsernameProblemLanguageResultExecution timeMemory
329473mihai145Mini tetris (IOI16_tetris)C++14
100 / 100
3 ms384 KiB
#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; }
#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...