제출 #956856

#제출 시각아이디문제언어결과실행 시간메모리
956856Dan4Life로봇 대회 (IOI23_robot)C++17
26 / 100
100 ms6100 KiB
#include "robot.h"
#include <bits/stdc++.h>
using namespace std;
int boundary = -2, obstacle = -1, white = 0, green = 1;
int blue = 2, red = 3, yellow = 4, orange = 5;
string dir = "WSENHT";
int i, j, k, l, m;

char get_dir(int col, vector<int> subset={1,2,3,4}){
    int pos = 4;
    for(auto u : subset){
        if(u==1 and j==col) pos=0;
        else if(u==2 and k==col) pos=1;
        else if(u==3 and l==col) pos=2;
        else if(u==4 and m==col) pos=3;
    }
    return dir[pos];
}

bool exists_neighbour(int col, vector<int> subset={1,2,3,4}){
    for(auto u : subset){
        if(u==1 and j==col) return true;
        if(u==2 and k==col) return true;
        if(u==3 and l==col) return true;
        if(u==4 and m==col) return true;
    }
    return false;
}

void Set(int f, char g){ set_instruction({i,j,k,l,m},f,g); }

void program_pulibot()
{
    for(i = 0; i <= 5; i++){
        for(j = -2; j <= 5; j++){
            for(k = -2; k <= 5; k++){
                for(l = -2; l <= 5; l++){
                    for(m = -2; m <= 5; m++){
                        if(i==green or exists_neighbour(green) or exists_neighbour(orange)){
                            if(exists_neighbour(red,{2,3}))
                                Set(orange,get_dir(red,{2,3}));
                            else if(exists_neighbour(orange))
                                Set(white,get_dir(orange));
                            else if(exists_neighbour(yellow))
                                Set(green,get_dir(yellow));
                            else if(k==boundary and l==boundary)
                                Set(green,'T');
                        }
                        else if(k==boundary and l==boundary) 
                            Set(yellow,get_dir(blue));
                        else if(exists_neighbour(yellow)){
                            if(exists_neighbour(blue)) 
                                Set(yellow,get_dir(blue));
                            else if(j==boundary and m==boundary) 
                                Set(green,'H');
                            else 
                                Set(white,get_dir(yellow));
                        }
                        else if(exists_neighbour(white,{2,3}))
                            Set(blue,get_dir(white,{2,3}));
                        else if(exists_neighbour(blue))
                            Set(red,get_dir(blue));
                    }
                }
            }
        }
    }
}
#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...