#include "robot.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> allStates;
void genStates() {
vector<int> vals = {-2,-1,0,1,2,3,4,5};
for(int a:vals) for(int b:vals) for(int c:vals)
for(int d:vals) for(int e:vals)
allStates.push_back({a,b,c,d,e});
}
bool empty(int x){ return x>=0; }
void program_pulibot() {
genStates();
for(auto S: allStates){
int cur=S[0],W=S[1],Sth=S[2],E=S[3],N=S[4];
// reached goal detection = no unexplored neighbors
bool has0 = (W==0||Sth==0||E==0||N==0);
// if current unvisited -> start DFS
if(cur==0){
if(W==0) set_instruction(S,2,'W');
else if(Sth==0) set_instruction(S,3,'S');
else if(E==0) set_instruction(S,4,'E');
else if(N==0) set_instruction(S,5,'N');
else set_instruction(S,1,'T');
continue;
}
// backtracking by parent color
if(cur==2) set_instruction(S,1,'E');
else if(cur==3) set_instruction(S,1,'N');
else if(cur==4) set_instruction(S,1,'W');
else if(cur==5) set_instruction(S,1,'S');
else set_instruction(S,1,'T');
}
}
| # | 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... |