#include "robot.h"
#include <bits/stdc++.h>
using namespace std;
const int MAX_COLOR = 19;
static int encode_state(const std::vector<int> &S) {
int state = 0;
for (int s : S)
{
state = (MAX_COLOR + 3) * state + s + 2;
}
return state;
}
map<int, int> used;
void set_instruction(vector<int> S, int Z, char A);
// {o < v > ^}
vector<int> s(5);
vector<int> all = {-1, -2, 0, 1};
vector<int> blocked = {-1, -2, 1};
void gen_instruction(vector<vector<int>> ps, int z, char a, int i = 0) {
if (i == 5) {
if (used[encode_state(s)]) return;
used[encode_state(s)] = 1;
set_instruction(s, z, a);
return;
}
for (int inst: ps[i]) {
s[i] = inst;
gen_instruction(ps, z, a, i + 1);
}
}
void program_pulibot() {
// v if possible, otherwise >, otherwise ^
gen_instruction({{0}, all, {-2}, {-2}, all}, 1, 'T');
gen_instruction({{0}, all, all, {0}, all}, 1, 'E');
gen_instruction({{0}, all, {0}, blocked, blocked}, 1, 'S');
gen_instruction({{0}, all, blocked, blocked, {0}}, 1, '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... |