제출 #1058383

#제출 시각아이디문제언어결과실행 시간메모리
1058383shmax로봇 대회 (IOI23_robot)C++17
28 / 100
99 ms6760 KiB
#include "robot.h"
#include <bits/stdc++.h>

using namespace std;

template<typename T>
using vec = vector<T>;

void program_pulibot() {
//    set_instruction({0, -2, 0, 0, -2}, 1, 'S');
//    set_instruction({0, -2, 0, 0, 1}, 1, 'S');
//    set_instruction({0, -2, -2, 0, 1}, 1, 'E');
//    set_instruction({0, 1, -2, 0, 0}, 1, 'E');
//    set_instruction({0, 1, -2, -2, 0}, 1, 'H');
//    set_instruction({1, 1, -2, -2, 0}, 1, 'T');

    auto process = [&](char c) {
        if (c == 'L') return 'W';
        if (c == 'R') return 'E';
        if (c == 'D') return 'S';
        if (c == 'U') return 'N';
        return c;
    };

    auto prev = [&](int x) {
        if (x == 2) return 'H';
        if (x == 3) return 'U';
        if (x == 4) return 'L';
        if (x == 5) return 'D';
        if (x == 6) return 'R';
    };
    auto to_clear = [&](int x) {
        return 1 < x and x < 7;
    };
    vec<int> all = {-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    for (auto cur: all) {
        if (cur == -2 or cur == -1) continue;

        for (auto l: all) {
            for (auto d: all) {
                for (auto r: all) {
                    for (auto u: all) {
                        int Z = -1;
                        char c = '*';
                        if (cur == 0) {
                            if (l == -2 and u == -2) {
                                Z = 2;
                            } else if (l > 0) {
                                Z = 4;
                            } else if (r > 0) {
                                Z = 6;
                            } else if (u > 0) {
                                Z = 3;
                            } else if (d > 0) {
                                Z = 5;
                            }
                            c = 'H';
                        }


                        if (cur == 9 or cur == 1) {
                            Z = 1;
                            {
                                if (l == 9) {
                                    c = 'L';
                                } else if (r == 9) {
                                    c = 'R';
                                } else if (u == 9) {
                                    c = 'U';
                                } else if (d == 9) {
                                    c = 'D';
                                }
                                if (l == -2 and u == -2) {
                                    c = 'T';
                                }
                                if (to_clear(l) and c != 'L') {
                                    c = 'L';
                                } else if (to_clear(r) and c != 'R') {
                                    c = 'R';
                                } else if (to_clear(u) and c != 'U') {
                                    c = 'U';
                                } else if (to_clear(d) and c != 'D') {
                                    c = 'D';
                                }
                            }
                        }
                        if (cur > 1 and cur < 7) {
                            if (l == 7 or r == 7 or d == 7 or u == 7) {
                                Z = 7;
                                c = 'H';
                            } else {
                                if (l == 1 or r == 1 or d == 1 or u == 1) {
                                    Z = 7;
                                    c = 'H';
                                } else {
                                    if (l == 8 or r == 8 or d == 8 or u == 8) {
                                        Z = 8;
                                        c = prev(cur);
                                    } else {
                                        if (r == -2 and d == -2) {
                                            c = prev(cur);
                                            Z = 8;
                                        } else {
                                            Z = cur;
                                            if (l == 0) {
                                                c = 'L';
                                            } else if (r == 0) {
                                                c = 'R';
                                            } else if (u == 0) {
                                                c = 'U';
                                            } else if (d == 0) {
                                                c = 'D';
                                            } else {
                                                c = prev(cur);
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        if (cur == 8) {
                            Z = 9;
                            if (r == -2 and d == -2) {
                                Z = 9;
                                c = 'H';
                            }
                            if (l == 8) {
                                c = 'L';
                            } else if (r == 8) {
                                c = 'R';
                            } else if (u == 8) {
                                c = 'U';
                            } else if (d == 8) {
                                c = 'D';
                            }
                        }


                        if (cur == 7) {
                            Z = 7;
                            if (to_clear(l)) {
                                c = 'L';
                            } else if (to_clear(r)) {
                                c = 'R';
                            } else if (to_clear(u)) {
                                c = 'U';
                            } else if (to_clear(d)) {
                                c = 'D';
                            } else {
                                Z = 0;
                                if (l == 7 or l == 1) {
                                    c = 'L';
                                } else if (r == 7 or r == 1) {
                                    c = 'R';
                                } else if (u == 7 or u == 1) {
                                    c = 'U';
                                } else if (d == 7 or d == 1) {
                                    c = 'D';
                                }
                            }
                        }
                        if (Z == -1 or c == '*') continue;

                        set_instruction({cur, l, d, r, u}, Z, process(c));
                    }
                }
            }
        }
    }

}

컴파일 시 표준 에러 (stderr) 메시지

robot.cpp: In lambda function:
robot.cpp:31:5: warning: control reaches end of non-void function [-Wreturn-type]
   31 |     };
      |     ^
#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...