이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |