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"
#ifdef ngu
#include "grader.cpp"
#endif // ngu
#include<bits/stdc++.h>
using namespace std;
void program_pulibot()
{
for(int cur = 0; cur <= 4; cur++) for(int west = -2; west <= 4; west++) {
for(int south = -2; south <= 4; south++) for(int east = -2; east <= 4; east++) for(int north = -2; north <= 4; north++) {
vector<int> state = {cur, west, south, east, north};
if (east == -2 && south == -2 && cur == 2) {
if (north == 3) set_instruction(state, 1, 'N');
else if (west == 3) set_instruction(state, 1, 'W');
else if (north == 2) set_instruction(state, 1, 'N');
else if (west == 2) set_instruction(state, 1, 'W');
continue;
}
int cnt = (south == 1) + (east == 1) + (west == 1) + (north == 1) + (cur == 1);
//explore
if (cur == 0 || (cur == 2 && cnt == 0)) {
if (south == 0) set_instruction(state, 2, 'S');
else if (east == 0) set_instruction(state, 2, 'E');
else if (west == 0) set_instruction(state, 2, 'W');
else if (north == 0) set_instruction(state, 2, 'N');
else if (south == 2) set_instruction(state, 3, 'S');
else if (east == 2) set_instruction(state, 3, 'E');
else if (west == 2) set_instruction(state, 3, 'W');
else if (north == 2) set_instruction(state, 3, 'N');
}
//erase
else {
if (north == -2 && west == -2 && south != 3 && east != 3 && (cur == 1 || cur == 2)) {
set_instruction(state, 1, 'T');
continue;
}
if (cur == 1 || cur == 2) {
if (south == 3) set_instruction(state, 1, 'S');
else if (east == 3) set_instruction(state, 1, 'E');
else if (west == 3) set_instruction(state, 1, 'W');
else if (north == 3) set_instruction(state, 1, 'N');
else if (south == 2) set_instruction(state, 1, 'S');
else if (east == 2) set_instruction(state, 1, 'E');
else if (west == 2) set_instruction(state, 1, 'W');
else if (north == 2) set_instruction(state, 1, 'N');
}
else {
if (south == 3) set_instruction(state, 4, 'S');
else if (east == 3) set_instruction(state, 4, 'E');
else if (west == 3) set_instruction(state, 4, 'W');
else if (north == 3) set_instruction(state, 4, 'N');
else if (south == 4) set_instruction(state, 0, 'S');
else if (east == 4) set_instruction(state, 0, 'E');
else if (west == 4) set_instruction(state, 0, 'W');
else if (north == 4) set_instruction(state, 0, 'N');
else if (south == 1) set_instruction(state, 0, 'S');
else if (east == 1) set_instruction(state, 0, 'E');
else if (west == 1) set_instruction(state, 0, 'W');
else if (north == 1) set_instruction(state, 0, 'N');
}
}
}
}
}
# | 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... |