Submission #956001

#TimeUsernameProblemLanguageResultExecution timeMemory
956001Dan4LifeRobot Contest (IOI23_robot)C++17
15 / 100
97 ms5804 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";
    for(int i = 0; i <= 1; 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 if(j==1 or k==1 or l==1 or m==1){
                            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
*/
#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...