Submission #955997

#TimeUsernameProblemLanguageResultExecution timeMemory
955997Dan4LifeRobot Contest (IOI23_robot)C++17
Compilation error
0 ms0 KiB
#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
*/

Compilation message (stderr)

robot.cpp: In function 'void program_pulibot()':
robot.cpp:10:5: error: 'string' was not declared in this scope
   10 |     string dir = "WSEN";
      |     ^~~~~~
robot.cpp:26:59: error: 'dir' was not declared in this scope
   26 |                             set_instruction({i,j,k,l,m},1,dir[pos]);
      |                                                           ^~~
robot.cpp:34:59: error: 'dir' was not declared in this scope
   34 |                             set_instruction({i,j,k,l,m},2,dir[pos]);
      |                                                           ^~~