이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |