이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "robot.h"
#include <set>
const int ANY = -3;
std::set<std::vector<int>> prog;
void set(std::vector<int> S, int Z, char A)
{
for (int i = 0; i < 5; i++)
{
if (S[i] == ANY)
{
auto S2 = S;
for (int j = -2; j <= 2; j++)
{
S2[i] = j;
set(S2, Z, A);
}
return;
}
}
if (prog.count(S))
return;
prog.insert(S);
set_instruction(S, Z, A);
}
void program_pulibot()
{
for(int north=-2;north<=2;north++){
for(int west=-2;west<=2;west++){
for(int south=-2;south<=2;south++){
for(int east=-2;east<=2;east++){
for(int here=-2;here<=2;here++){
if(here<0){
continue;
}
int cnt=0;
if(north==2){
cnt++;
}
if(west==-2){
cnt++;
}
if(south==-2){
cnt++;
}
if(east==-2){
cnt++;
}
if(cnt>2){
continue;
}
if(east == -2 && south == -2){
set_instruction({here,west,south,east,north},1,'T');
} else if(east == 0){
set_instruction({here,west,south,east,north},1,'E');
} else if(north == 0){
set_instruction({here,west,south,east,north},1,'N');
} else if(south == 0){
set_instruction({here,west,south,east,north},1,'S');
} else if(west == 0){
set_instruction({here,west,south,east,north},1,'W');
} else if(east == 1){
set_instruction({here,west,south,east,north},2,'E');
} else if(north == 1){
set_instruction({here,west,south,east,north},2,'N');
} else if(south == 1){
set_instruction({here,west,south,east,north},2,'S');
} else if(west == 1){
set_instruction({here,west,south,east,north},2,'W');
}
}
}
}
}
}
set({1, ANY, 1, 2, ANY}, 1, 'E');
set({1, 1, 1, ANY, ANY}, 1, 'W');
set({1, 1, ANY, 1, ANY}, 1, 'W');
set({1, ANY, 1, ANY, 1}, 1, 'N');
set({1, ANY, ANY, 1, 1}, 1, 'N');
set({1, -2, 1, ANY, -2}, 1, 'T');
set({1, -2, ANY, 1, -2}, 1, 'T');
set({2, ANY, 2, ANY, ANY}, 2, 'S');
set({2, ANY, ANY, 2, ANY}, 2, 'E');
set({2, 1, ANY, ANY, ANY}, 0, 'W');
set({2, 2, ANY, ANY, ANY}, 0, 'W');
set({2, ANY, ANY, ANY, 2}, 0, 'N');
set({ANY, 1, -2, -2, ANY}, 1, 'W');
set({ANY, ANY, -2, -2, 1}, 1, 'N');
set({ANY, ANY, ANY, 0, ANY}, 1, 'E');
set({ANY, ANY, 0, ANY, ANY}, 1, 'S');
set({ANY, ANY, 0, ANY, ANY}, 1, 'S');
set({ANY, ANY, ANY, ANY, 1}, 2, 'N');
set({ANY, 1, ANY, ANY, ANY}, 2, 'W');
}
# | 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... |