Submission #1067637

#TimeUsernameProblemLanguageResultExecution timeMemory
1067637Ahmed57로봇 대회 (IOI23_robot)C++17
100 / 100
101 ms5980 KiB
#include "bits/stdc++.h"
#include "robot.h"
 
using namespace std;
//2 WEST
//3 SOUTH
//4 EAST
//5 NORTH
enum Id {
    Bound = -2,
    Block,
    Empty,
    Path,
    West,
    South,
    East,
    North
};
char arr[] = {'W','S','E','N'};
 
void program_pulibot(){
    for(int c = 0;c<=5;c++){
        for(int w = -2;w<=5;w++){
            for(int s = -2;s<=5;s++){
                for(int e = -2;e<=5;e++){
                    for(int n = -2;n<=5;n++){
                        vector<int> lol = {w,s,e,n};
                        if(c==0){
                            if(n==Bound&&w==Bound){
                                if(s==Block){
                                    set_instruction({c,w,s,e,n},East,'E');
                                }else{
                                    set_instruction({c,w,s,e,n},South,'S');
                                }
                            }else if(s==Bound&&e==Bound){
                                set_instruction({c,w,s,e,n},East,'H');
                            }else{
                                for(int i = 0;i<4;i++){
                                    if(lol[i]-2==(i+2)%4){
                                        set_instruction({c,w,s,e,n},West+i,arr[i]);
                                        break;
                                    }
                                }
                            }
                        }else{
                            if(lol[c-2]-2==c%4){
                                for(int ee = 1;ee<=4;ee++){
                                    int i = (c-2+ee)%4;
                                    if(lol[i]-2==(i+2)%4||lol[i]==Empty){
                                        set_instruction({c,w,s,e,n},West+i,arr[i]);
                                        break;
                                    }
                                }
                            }else{
                                bool path = 0;
                                bool done = 0;
                                for(int ee = 1;ee<=4;ee++){
                                    int i = (c-2+ee)%4;
                                    if(lol[i]==1){
                                        path = 1;
                                    }
                                    if(lol[i]-2==(i+2)%4){
                                        set_instruction({c,w,s,e,n},c,arr[i]);
                                        done = 1;
                                        break;
                                    }
                                }
                                if(done)continue;
                                set_instruction({c,w,s,e,n},(path||(w==Bound&&n==Bound))?Path:Empty,(e==Bound&&s==Bound)?'T':arr[(c+2)%4]);
                            }
                        }
                    }
                }
            }
        }
    }
}
#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...