제출 #1074620

#제출 시각아이디문제언어결과실행 시간메모리
1074620Unforgettablepl로봇 대회 (IOI23_robot)C++17
16 / 100
135 ms6060 KiB
#include "robot.h"
#include <bits/stdc++.h>
using namespace std;

enum directions {
    e,
    s,
    n,
    w,
};

void program_pulibot() {
    for(int current=0;current<=5;current++) {
        for(int west=-2;west<=6;west++) {
            for(int south=-2;south<=6;south++) {
                for(int north=-2;north<=6;north++) {
                    for(int east=-2;east<=6;east++) {
                        vector<int> cur = {current,west,south,east,north};
                        directions parent = w;
                        if(west==2)parent=w;
                        else if(east==5)parent=e;
                        else if(north==3)parent=n;
                        else if(south==4)parent=s;
                        if(current==1) {
                            if(north==-2 and west==-2) {
                                set_instruction(cur,1,'T');
                                continue;
                            }
                            char par;
                            if(parent==w)par='W';
                            else if(parent==e)par='E';
                            else if(parent==s)par='S';
                            else par='N';
                            set_instruction(cur,1,par);
                            continue;
                        }
                        if(south==-2 and east==-2) {
                            // we have found a path
                            set_instruction(cur,1,'H');
                            continue;
                        }
                        if(current==0) {
                            // Go east, no processing needed
                            if(parent==e or east!=0){
                                set_instruction(cur,2,'H');
                            } else {
                                set_instruction(cur,2,'E');
                            }
                        } else if(current==2) {
                            // Process that we came from east and try to go south
                            if(parent!=e and east==1) {
                                set_instruction(cur,1,'H');
                            } else if(parent==s or south!=0) {
                                set_instruction(cur,3,'H');
                            } else {
                                set_instruction(cur,3,'S');
                            }
                        } else if(current==3) {
                            // Process that we came from south and try to go north
                            if(parent!=s and south==1) {
                                set_instruction(cur,1,'H');
                            } else  {
                                set_instruction(cur,4,'H');
                            }
                        } else if(current==4) {
                            // Process that we came from north and try to go west
                            set_instruction(cur,5,'H');
                        } else if(current==5) {
                            // Process that we looked west, if nothing return to parent
                            char par;
                            if(parent==w)par='W';
                            else if(parent==e)par='E';
                            else if(parent==s)par='S';
                            else par='N';
                            set_instruction(cur,6,par);
                        }
                    }
                }
            }
        }
    }
}
#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...