# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
841549 | QwertyPi | Robots (APIO13_robots) | C++14 | 0 ms | 0 KiB |
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;
// {CELL, LEFT, DOWN, RIGHT, UP}
void instruct(vector<int> A, int colour, char action){
for(int i0 = A[0] == ALL ? -2 : A[0]; i0 <= (A[0] == ALL ? K_MAX : A[0]); i0++){
for(int i1 = A[1] == ALL ? -2 : A[1]; i1 <= (A[1] == ALL ? K_MAX : A[1]); i1++){
for(int i2 = A[2] == ALL ? -2 : A[2]; i2 <= (A[2] == ALL ? K_MAX : A[2]); i2++){
for(int i3 = A[3] == ALL ? -2 : A[3]; i3 <= (A[3] == ALL ? K_MAX : A[3]); i3++){
for(int i4 = A[4] == ALL ? -2 : A[4]; i4 <= (A[4] == ALL ? K_MAX : A[4]); i4++){
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, ALL, EMPTY, ALL}, 1, DIR_RIGHT);
instruct({ALL, ALL, EMPTY, ALL, ALL}, 1, DIR_DOWN);
instruct({ALL, ALL, WALL, WALL, ALL}, 1, DIR_TERM);
}