Submission #956237

#TimeUsernameProblemLanguageResultExecution timeMemory
956237Dan4Life로봇 대회 (IOI23_robot)C++17
0 / 100
95 ms5808 KiB
#include "robot.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(a) (int)a.size() #define all(a) begin(a),end(a) using ll = long long; using vi = vector<int>; using vll = vector<ll>; // 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, vector<int> subset={1,2,3,4}){ int pos = 4; for(int cur = 0; cur < sz(subset); cur++){ auto u = subset[cur]; if(u==1 and j==col) pos=0; else if(u==2 and k==col) pos=1; else if(u==3 and l==col) pos=2; else if(u==4 and m==col) pos=3; } return dir[pos]; } bool exists_neighbour(int col, vector<int> subset={1,2,3,4}){ for(int cur = 0; cur < sz(subset); cur++){ auto u = subset[cur]; if(u==1 and j==col) return true; if(u==2 and k==col) return true; if(u==3 and l==col) return true; if(u==4 and m==col) return true; } return false; } 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, terminate set_instruction({i,j,k,l,m},blue,'T'); } else if(exists_neighbour(white,{2,3})){ // if still in the exploration phase and we can explore down or left: // go to the next unvisited position, randomly set_instruction({i,j,k,l,m},blue,get_dir(white,{2,3})); } else if(exists_neighbour(blue)){ // no where to go, mark as blocked, backtrack set_instruction({i,j,k,l,m},red,get_dir(blue)); } } } } } } } /* always go down if possible (color with blue) else always go right if possible (color with blue) if we eventually reach the end: on to the next phase, but before we do that, lets submit else: it is not possible to move down or right, so backtrack while coloring red and go back to the previous 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...