This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
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;
}
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);
}
}
}
}
}
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |