# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
856186 | Sorting | 로봇 대회 (IOI23_robot) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "robot.h"
#include <vector>
using namespace std;
void set_from_states(int curr, int west, int south, int east, int north){
vector<int> states{curr, west, south, east, north};
if(east == -2 && south == -2){
if(curr == 0){
char dir = 'X';
if(east == 1)dir = 'E';
if(west == 1)dir = 'W';
if(north == 1)dir = 'N';
if(south == 1)dir = 'S';
set_instruction(states, 3, dir);
return;
}
set_instruction(states, 1, 'T');
return;
}
if(curr == 2){
char dir = 'X';
if(east == 2) dir = 'E';
if(west == 2) dir = 'W';
if(north == 2)dir = 'N';
if(south == 2)dir = 'S';
if(dir != 'X'){
set_instruction(states, 4, dir);
return;
}
if(east == 4) dir = 'E';
if(west == 4) dir = 'W';
if(north == 4)dir = 'N';
if(south == 4)dir = 'S';
set_instruction(states, 0, dir);
return;
}
if(curr == 4){
char dir = 'X';
if(east == 3) dir = 'E';
if(west == 3) dir = 'W';
if(north == 3)dir = 'N';
if(south == 3)dir = 'S';
if(dir != 'X'){
set_instruction(states, 0, dir);
return;
}
if(east == 4) dir = 'E';
if(west == 4) dir = 'W';
if(north == 4)dir = 'N';
if(south == 4)dir = 'S';
set_instruction(states, 0, dir);
return;
}
if(curr == 0){
char dir = 'X';
if(east == 0) dir = 'E';
if(west == 0) dir = 'W';
if(north == 0)dir = 'N';
if(south == 0)dir = 'S';
if(dir != 'X'){
set_instruction(states, 1, dir);
return;
}
if(east == 1)dir = 'E';
if(west == 1)dir = 'W';
if(north == 1)dir = 'N';
if(south == 1)dir = 'S';
set_instruction(states, 2, dir);
return;
}
if(curr == 1){
int count_3 = 0;
count_3 += east == 3;
count_3 += west == 3;
count_3 += north == 3;
count_3 += south == 3;
if(count_3){
char dir = 'X';
if(east == 2) dir = 'E';
if(west == 2) dir = 'W';
if(north == 2)dir = 'N';
if(south == 2)dir = 'S';
if(dir != 'X'){
set_instruction(states, 3, dir);
return;
}
char dir = 'X';
if(east == 1) dir = 'E';
if(west == 1) dir = 'W';
if(north == 1)dir = 'N';
if(south == 1)dir = 'S';
set_instruction(states, 3, dir);
return;
}
char dir = 'X';
if(east == 0) dir = 'E';
if(west == 0) dir = 'W';
if(north == 0)dir = 'N';
if(south == 0)dir = 'S';
if(dir != 'X'){
set_instruction(states, 1, dir);
return;
}
char dir = 'X';
if(east == 1) dir = 'E';
if(west == 1) dir = 'W';
if(north == 1)dir = 'N';
if(south == 1)dir = 'S';
set_instruction(states, 2, dir);
return;
}
if(curr == 3){
char dir = 'X';
if(east == 3) dir = 'E';
if(west == 3) dir = 'W';
if(north == 3)dir = 'N';
if(south == 3)dir = 'S';
set_instruction(states, 1, dir);
return;
}
}
void program_pulibot()
{
for(int curr = 0; curr <= 4; ++curr){
for(int east = -2; east <= 4; ++east){
for(int south = -2; south <= 4; ++south){
for(int north = -2; north <= 4; ++north){
for(int west = -2; west <= 4; ++west){
set_from_states(curr, west, south, east, north);
}
}
}
}
}
}