제출 #956189

#제출 시각아이디문제언어결과실행 시간메모리
956189Dan4Life로봇 대회 (IOI23_robot)C++17
24 / 100
107 ms5772 KiB
#include "robot.h" #include <bits/stdc++.h> using namespace std; // 0 = unvisited (white) // 1 = final visit (yellow) // 2 = temp. visit (blue) // 3 = blocked (red) int boundary = -2; int white = 0, yellow = 1, blue = 2, red = 3; string dir = "WSENHT"; int i, j, k, l, m; char get_dir(int col){ int pos = 4; if(j==col) pos=0; else if(k==col) pos=1; else if(l==col) pos=2; else if(m==col) pos=3; return dir[pos]; } bool exists_neighbour(int col){ return j==col or k==col or l==col or m==col; } void program_pulibot() { for(i = 0; i <= 3; i++){ for(j = -2; j <= 3; j++){ for(k = -2; k <= 3; k++){ for(l = -2; l <= 3; l++){ for(m = -2; m <= 3; m++){ if(k==boundary and l==boundary){ // final location, start coloring with yellow, go back to last blue set_instruction({i,j,k,l,m},yellow,get_dir(blue)); } else if(exists_neighbour(yellow)){ // if yellow somewhere, we are in the final phase if(exists_neighbour(red)){ // firstly if there's red cell, go there while marking here as yellow set_instruction({i,j,k,l,m},yellow,get_dir(red)); } else if(exists_neighbour(blue)){ // if no red cell, but there are blue cells, go there set_instruction({i,j,k,l,m},yellow,get_dir(blue)); } else if(j==boundary and m==boundary){ // starting location we can terminate now set_instruction({i,j,k,l,m},yellow,'T'); } else{ // if we are in a blocked place already, clear it, traverse back set_instruction({i,j,k,l,m},white,get_dir(yellow)); } } else if(exists_neighbour(white)){ // if still in the exploration phase and we can explore: // go to the next unvisited position, randomly set_instruction({i,j,k,l,m},blue,get_dir(white)); } else if(exists_neighbour(blue)){ // no where to go, mark as blocked, backtrack set_instruction({i,j,k,l,m},red,get_dir(blue)); } } } } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...