제출 #1029662

#제출 시각아이디문제언어결과실행 시간메모리
1029662Andrey로봇 대회 (IOI23_robot)C++17
17 / 100
170 ms5976 KiB
#include "robot.h"
#include<bits/stdc++.h>
using namespace std;
 
bool check(int a, int x) {
    if(a >= 2 && a <= 5 && (a-x+1002)%4 == 0) {
        return true;
    }
    return false;
}
 
void program_pulibot()
{
    char dir[6] = {'z','T','W','S','E','N'};
    for(int c = 0; c < 6; c++) {
        for(int w = -2; w < 6; w++) {
            for(int s = -2; s < 6; s++) {
                for(int e = -2; e < 6; e++) {
                    for(int n = -2; n < 6; n++) {
                        if(c == 0) {
                            if(s == -2 && e == -2) {
                                set_instruction({c,w,s,e,n},1,'H');
                                continue;
                            }
                            if(w == -2 && n == -2) {
                                set_instruction({c,w,s,e,n},2,'H');
                            }
                            else if(check(w,2)) {
                                set_instruction({c,w,s,e,n},2,'W');
                            }
                            else if(check(s,3)) {
                                set_instruction({c,w,s,e,n},3,'S');
                            }
                            else if(check(e,4)) {
                                set_instruction({c,w,s,e,n},4,'E');
                            }
                            else if(check(n,5)) {
                                set_instruction({c,w,s,e,n},5,'N');
                            }
                            continue;
                        }
                        if(c == 1) {
                            if(w == -2 && n == -2) {
                                set_instruction({c,w,s,e,n},1,'T');
                                continue;
                            }
                            if(check(w,2)) {
                                set_instruction({c,w,s,e,n},1,'W');
                            }
                            else if(check(s,3)) {
                                set_instruction({c,w,s,e,n},1,'S');
                            }
                            else if(check(e,4)) {
                                set_instruction({c,w,s,e,n},1,'E');
                            }
                            else if(check(n,5)) {
                                set_instruction({c,w,s,e,n},1,'N');
                            }
                            else {
                                if(w == 1) {
                                    set_instruction({c,w,s,e,n},0,'W');
                                }
                                else if(s == 1) {
                                    set_instruction({c,w,s,e,n},0,'S');
                                }
                                else if(e == 1) {
                                    set_instruction({c,w,s,e,n},0,'E');
                                }
                                else if(n == 1) {
                                    set_instruction({c,w,s,e,n},0,'N');
                                }
                            }
                            continue;
                        }
                        if(s == 1 || w == 1 || n == 1 || e == 1) {
                            set_instruction({c,w,s,e,n},1,'H');
                            continue;
                        }
                        int p = c+1,x = 0;
                        if(p == 6) {
                            p-=4;
                        }
                        if(p == 2) {
                            x = w;
                        }
                        else if(p == 3) {
                            x = s;
                        }
                        else if(p == 4) {
                            x = e;
                        }
                        else if(p == 5) {
                            x = n;
                        }
                        if(x == 0 || check(x,p)) {
                            set_instruction({c,w,s,e,n},p,dir[p]);
                        }
                        else {
                            set_instruction({c,w,s,e,n},p,'H');
                        }
                    }
                }
            }
        }
    }
}
#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...