Submission #956016

#TimeUsernameProblemLanguageResultExecution timeMemory
956016Dan4LifeRobot Contest (IOI23_robot)C++17
0 / 100
1 ms348 KiB
#include "robot.h" #include <bits/stdc++.h> using namespace std; 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"; // 0 means unvisited (white) // 1 means final visit (yellow) // 2 means blocked (red) // 3 means temp. visit (blue) int white = 0, yellow = 1, red = 2, blue = 3; for(int i = 0; i <= 3; i++){ for(int j = -2; j <= 3; j++){ for(int k = -2; k <= 3; k++){ for(int l = -2; l <= 3; l++){ for(int m = -2; m <= 3; m++){ if(j==-2 and m==-2 and i==yellow){ // starting location and color = yellow set_instruction({i,j,k,l,m},yellow,'T'); } else if(k==-2 and l==-2){ // final location, start coloring with yellow int pos = -1; if(j==blue) pos=0; else if(k==blue) pos=1; else if(l==blue) pos=2; else if(m==blue) pos=3; set_instruction({i,j,k,l,m},yellow,dir[pos]); } else if(j==yellow or k==yellow or l==yellow or m==yellow){ // if yellow somewhere, we are in the final phase if(j==red or k==red or l==red or m==red){ // firstly if there's red cell, go there while marking here as yellow int pos = -1; if(j==red) pos=0; else if(k==red) pos=1; else if(l==red) pos=2; else if(m==red) pos=3; set_instruction({i,j,k,l,m},yellow,dir[pos]); } else if(j==blue or k==blue or l==blue or m==blue){ // if no red cell, but there are blue cells, go there int pos = -1; if(j==blue) pos=0; else if(k==blue) pos=1; else if(l==blue) pos=2; else if(m==blue) pos=3; set_instruction({i,j,k,l,m},yellow,dir[pos]); } else if(i==red or i==yellow){ // if we are in a blocked place already, clear it, traverse back int pos = -1; if(j==yellow) pos=0; else if(k==yellow) pos=1; else if(l==yellow) pos=2; else if(m==yellow) pos=3; set_instruction({i,j,k,l,m},white,dir[pos]); } } else if(i==blue and (j==white or k==white or l==white or m==white)){ // if still in the exploration phase and we can explore: // go to the next unvisited position, randomly int pos = -1; if(j==white) pos=0; else if(k==white) pos=1; else if(l==white) pos=2; else if(m==white) pos=3; set_instruction({i,j,k,l,m},blue,dir[pos]); } else if((i==white or i==blue) and (j==blue or k==blue or l==blue or m==blue)){ // if we just entered a new cell or we are in an already temporarily visited cell and no where to go, // mark as blocked, backtrack int pos = -1; if(j==blue) pos=0; else if(k==blue) pos=1; else if(l==blue) pos=2; else if(m==blue) pos=3; set_instruction({i,j,k,l,m},red,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 */
#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...