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 <bits/stdc++.h>
const int ALL = -3;
const int WALL = -2;
const int STONE = -1;
const int EMPTY = 0;
const int PATH = 1;
const int VISITED = 2;
const int LEFT = 3;
const int DOWN = 4;
const int RIGHT = 5;
const int UP = 6;
const int K_MAX = 6;
using namespace std;
const char DIR_STAY = 'H';
const char DIR_LEFT = 'W';
const char DIR_DOWN = 'S';
const char DIR_RIGHT = 'E';
const char DIR_UP = 'N';
const char DIR_TERM = 'T';
map<vector<int>, pair<int, char>> mp;
vector<int> expand(int T){
if(T == ALL){
vector<int> v; for(int i = -2; i <= K_MAX; i++) v.push_back(i);
return v;
}
return {T};
}
// {CELL, LEFT, DOWN, RIGHT, UP}
void instruct(vector<int> A, int colour, char action){
for(auto i0 : expand(A[0]))
for(auto i1 : expand(A[1]))
for(auto i2 : expand(A[2]))
for(auto i3 : expand(A[3]))
for(auto i4 : expand(A[4]))
{
vector<int> a = {i0, i1, i2, i3, i4};
if(mp.count(a)) continue;
mp[a] = {colour, action};
set_instruction(a, colour, action);
}
}
void program_pulibot(){
instruct({ALL, ALL, WALL, WALL, ALL}, PATH, DIR_TERM);
instruct({ALL, EMPTY, ALL, ALL, ALL}, PATH, DIR_LEFT);
instruct({ALL, ALL, EMPTY, ALL, ALL}, PATH, DIR_DOWN);
instruct({ALL, ALL, ALL, EMPTY, ALL}, PATH, DIR_RIGHT);
instruct({ALL, ALL, ALL, ALL, EMPTY}, PATH, DIR_UP);
instruct({ALL, PATH, ALL, ALL, ALL}, VISITED, DIR_LEFT);
instruct({ALL, ALL, PATH, ALL, ALL}, VISITED, DIR_DOWN);
instruct({ALL, ALL, ALL, PATH, ALL}, VISITED, DIR_RIGHT);
instruct({ALL, ALL, ALL, ALL, PATH}, VISITED, DIR_UP);
}
# | 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... |