# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
955997 | Dan4Life | Robot Contest (IOI23_robot) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "robot.h"
void program_pulibot()
{
//set_instruction({0, -2, -1, 0, -2}, 1, 'E');
//set_instruction({0, 1, -1, 0, -2}, 1, 'E');
//set_instruction({0, 1, 0, -2, -2}, 1, 'S');
//set_instruction({0, -1, -2, -2, 1}, 1, 'T');
string dir = "WSEN";
for(int i = 0; i <= 2; i++){
for(int j = -2; j <= 2; j++){
for(int k = -2; k <= 2; k++){
for(int l = -2; l <= 2; l++){
for(int m = -2; m <= 2; m++){
if(k==-2 and l==-2){
// final location
set_instruction({i,j,k,l,m},1,'T');
}
else if(!j or !k or !l or !m){
int pos = -1;
if(!j) pos=0;
else if(!k) pos=1;
else if(!l) pos=2;
else if(!m) pos=3;
set_instruction({i,j,k,l,m},1,dir[pos]);
}
else{
int pos = -1;
if(j==1) pos=0;
else if(k==1) pos=1;
else if(l==1) pos=2;
else if(m==1) pos=3;
set_instruction({i,j,k,l,m},2,dir[pos]);
}
}
}
}
}
}
}
/*
if there's an unvisited place: mark 1, go there (random choice if many unvisited)
Otherwise from now on there's no where to go:
if at the final cell: mark 1, terminate
else:
mark 2: go to the place marked 1
if we have a dead end (no places marked 0): go to the place marked 1
if there's no unvisited place, go back
*/