제출 #853237

#제출 시각아이디문제언어결과실행 시간메모리
853237dranjohn로봇 대회 (IOI23_robot)C++17
34 / 100
110 ms6784 KiB
#include "robot.h" #include <bits/stdc++.h> using namespace std; // https://oj.uz/problem/view/IOI23_robot constexpr int MAXS = 7; pair<char, int> dir(int self, int left, int down, int right, int up) { // clean up blockades if ((left == 1 || right == 1 || up == 1) && down == 6) { return { 'S', 7 }; } if (up == 7) { if (down == 0) return { 'N', 0 }; if (down < 0) return { 'N', 0 }; return { 'S', 7 }; } // done if (right == -2 && down == -2) return { up == 3 ? 'N' : 'W', 1 }; if ((right == 1 || down == 1) && left == -2 && up == -2) return { 'T', 1 }; // finalize solution if (left == 1 || down == 1 || right == 1 || up == 1) { if (right == 4) return { 'E', 1 }; if (down == 5) return { 'S', 1 }; if (left == 2) return { 'W', 1 }; if (up == 3) return { 'N', 1 }; } // block off if (up == 6) { if (self == 6) return { 'N', 6 }; if (down == 0) return { 'S', 6 }; if (up == 3 && right == 0) return { 'E', 6 }; return { 'N', 6 }; } // search deeper if (self == 6) { if (up < 0) return { 'E', 2 }; if (right == 0) return { 'E', 2 }; if (down == 6) return { 'S', 3 }; if (left == 0) return { 'W', 4 }; return { 'N', 0 }; } if (right == 0 && self < 2) { if (down == 0) return { 'S', 6 }; return { 'E', 2 }; } if ((down == 0 || down == 6) && self < 3) return { 'S', 3 }; if (left == 0 && self < 4) return { 'W', 4 }; if (up == 0 && self < 5) return { 'N', 5 }; // backtrack from dead end if (right == 4) return { 'E', 0 }; if (down == 5) return { 'S', 0 }; if (left == 2) return { 'W', 0 }; if (up == 3) return { 'N', 0 }; // unknown state return { 'T', 19 }; } void program_pulibot() { vector<int> states; for (int i = -2; i <= MAXS; ++i) states.push_back(i); for (int l : states) for (int d : states) for (int r : states) for (int u : states) for (int s : states) { char nd; int ns; tie(nd, ns) = dir(s, l, d, r, u); set_instruction({ s, l, d, r, u }, ns, nd); } }
#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...