#include "robot.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void set_instruction(int a, int b, int c, int d, int e, int z, char A){
set_instruction(vector<int> {a, b, c, d, e}, z, A);
}
void program_pulibot(){
for(int now=-2; now<=5; now++){
for(int l=-2; l<=5; l++){
for(int d=-2; d<=5; d++){
for(int r=-2; r<=5; r++){
for(int u=-2; u<=5; u++){
if(now!=1 && l!=1 && d!=1 && r!=1 && u!=1){ /// Phase 1
if(r==-2 && d==-2){ /// 끝점 도달
set_instruction(now, l, d, r, u, 1, 'H');
}
else switch(now){
case 0:
if(l==0) {set_instruction(now, l, d, r, u, 2, 'W'); break;}
case 2:
if(d==0) {set_instruction(now, l, d, r, u, 3, 'S'); break;}
case 3:
if(r==0) {set_instruction(now, l, d, r, u, 4, 'E'); break;}
case 4:
if(u==0) {set_instruction(now, l, d, r, u, 5, 'N'); break;}
case 5:
/// 탐색 실패
if(l>=2) set_instruction(now, l, d, r, u, 0, 'W');
else if(d>=2) set_instruction(now, l, d, r, u, 0, 'S');
else if(r>=2) set_instruction(now, l, d, r, u, 0, 'E');
else if(u>=2) set_instruction(now, l, d, r, u, 0, 'N');
}
}
else{ /// Phase 2
if(l==-2 && u==-2) set_instruction(now, l, d, r, u, 1, 'T');
else if(l>=2) set_instruction(now, l, d, r, u, 1, 'W');
else if(d>=2) set_instruction(now, l, d, r, u, 1, 'S');
else if(r>=2) set_instruction(now, l, d, r, u, 1, 'E');
else if(u>=2) set_instruction(now, l, d, r, u, 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... |