#include "robot.h"
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define ff first
#define ss second
#define pb push_back
char lt = 'W';
char rt = 'E';
char up = 'N';
char down = 'S';
char T = 'T';
char stay = 'H';
// left down right up
vi all = {0, -1, -2, 1};
vi non_zero = {-1, -2, 1};
vi zero = {0};
vi border = {-2};
vi block = {-1};
vi closed = {-1, -2};
vi two = {2};
vi one = {1};
vi four = {4};
vi three = {3};
map<vi, bool> vis;
void add(int col, vi tp, vi tp2, vi tp3, vi tp4, int res_col, char res){
for(int x: tp){
for(int y: tp2){
for(int z: tp3){
for(int tt: tp4){
vi X = {col, x, y, z, tt};
if(vis[X]) continue;
set_instruction(X, res_col, res);
vis[X] = true;
}
}
}
}
}
void go_color(int col, int goo, int res){
vi other;
vi go = {goo};
for(int j = -2; j <= 4; ++j) if(j != goo) other.pb(j);
add(col, go, other, other, other, res, lt);
add(col, other, go, other, other, res, down);
add(col, other, other, go, other, res, rt);
add(col, other, other, other, go, res, up);
add(col, go, go, other, other, res, down);
add(col, go, other, go, other, res, rt);
add(col, go, other, other, go, res, up);
add(col, go, go, other, other, res, down);
add(col, other, go, go, other, res, rt);
add(col, other, go, other, go, res, down);
add(col, go, other, go, other, res, rt);
add(col, other, go, go, other, res, rt);
add(col, other, other, go, go, res, rt);
add(col, go, other, go, go, res, rt);
add(col, other, go, go, go, res, rt);
add(col, go, go, other, go, res, down);
add(col, go, go, go, other, res, rt);
}
void go_color_if(int col, int goo, int res, int depp){
vi other;
vi go = {goo};
vi dep = {depp};
for(int j = -2; j <= 4; ++j) if(j != goo && j != depp) other.pb(j);
add(col, dep, go, other, other, res, down);
add(col, dep, go, go, other, res, down);
add(col, dep, go, go, go, res, down);
add(col, dep, other, go, other, res, rt);
add(col, dep, other, go, go, res, rt);
add(col, dep, other, other, go, res, up);
add(col, go, dep, other, other, res, lt);
add(col, go, dep, go, other, res, lt);
add(col, go, dep, go, go, res, lt);
add(col, other, dep, go, other, res, rt);
add(col, other, dep, go, go, res, rt);
add(col, other, dep, other, go, res, up);
add(col, go, other, dep, other, res, lt);
add(col, go, go, dep, other, res, lt);
add(col, go, go, dep, go, res, lt);
add(col, other, go, dep, other, res, down);
add(col, other, go, dep, go, res, down);
add(col, other, other, dep, go, res, up);
add(col, go, other, other, dep, res, lt);
add(col, go, go, other, dep, res, lt);
add(col, go, go, go, dep, res, lt);
add(col, other, go, other, dep, res, down);
add(col, other, go, go, dep, res, down);
add(col, other, other, go, dep, res, rt);
}
void stuck(int col, int go){
vi st = {-2, -1, 3};
add(col, two, st, st, st, go, lt);
add(col, st, two, st, st, go, down);
add(col, st, st, two, st, go, rt);
add(col, st, st, st, two, go, up);
}
void stuck2(int col, int go){
vi st = {-2, -1, 0, 1, 2, 4};
add(col, four, st, st, st, go, lt);
add(col, st, four, st, st, go, down);
add(col, st, st, four, st, go, rt);
add(col, st, st, st, four, go, up);
}
void stuck3(int col, int go){
vi st = {-2, -1, 0, 1, 2, 4};
add(col, two, st, st, st, go, lt);
add(col, st, two, st, st, go, down);
add(col, st, st, two, st, go, rt);
add(col, st, st, st, two, go, up);
}
void program_pulibot(){
// vi one = {1};
vi all_but_two = {-2, -1, 0, 1, 3, 4};
vi some = {-2, -1, 0, 3, 4};
add(2, border, three, one, border, 2, down);
add(2, border, one, three, border, 2, rt);
add(2, border, one, some, border, 1, T);
add(2, border, some, one, border, 1, T);
add(0, two, border, border, all_but_two, 1, lt);
add(0, all_but_two, border, border, two, 1, up);
go_color(0, 0, 2);
go_color_if(2, 3, 2, 1);
go_color_if(2, 2, 1, 1);
go_color(2, 0, 2);
stuck(0, 3);
stuck(2, 3);
stuck2(3, 0);
stuck3(3, 0);
go_color(2, 3, 2);
go_color(3, 3, 4);
go_color(4, 3, 4);
go_color(4, 4, 0);
go_color(4, 2, 0);
go_color(4, 1, 0);
// add(2, one, two, some, some, 1, down);
// add(2, one, some, two, some, 1, rt);
// add(2, one, some, some, two, 1, up);
// add(2, two, one, some, some, 1, lt);
// add(2, some, one, two, some, 1, rt);
// add(2, some, one, some, two, 1, up);
// add(2, two, some, one, some, 1, lt);
// add(2, some, two, one, some, 1, down);
// add(2, some, some, one, two, 1, up);
// add(2, two, some, some, one, 1, lt);
// add(2, some, two, some, one, 1, down);
// add(2, some, some, two, one, 1, rt);
}
# | 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... |