Submission #853914

#TimeUsernameProblemLanguageResultExecution timeMemory
853914maomao90Robot Contest (IOI23_robot)C++17
100 / 100
104 ms6228 KiB
#include <bits/stdc++.h> #include "robot.h" using namespace std; const int Z = 5; const char key[] = "HTWSEN"; pair<int, char> solve(vector<int> S) { vector<int> s = S; s.insert(s.begin() + 1, 0); bool tlcorner = s[2] == -2 && s[5] == -2, brcorner = s[3] == -2 && s[4] == -2; int d = s[0]; if (d == 0) { if (brcorner) { return {4, key[0]}; } int nd = -1; for (int k = 2; k <= 5; k++) { if ((s[k] ^ 6) == k) { return {k, key[k]}; } if (s[k] == 0 && nd == -1) { nd = k; } } if (tlcorner && nd != -1) { return {nd, key[nd]}; } } else if ((s[d] ^ 6) == d) { while (++d > Z ? d -= 4 : 1) { if ((s[d] ^ 6) == d || s[d] == 0) { return {d, key[d]}; } } } else { int cnt1 = 0; for (int k = 2; k <= 5; k++) { if ((s[k] ^ 6) == k) { return {d, key[k]}; } cnt1 += s[k] == 1; } return {tlcorner || cnt1, key[brcorner ? 1 : d]}; } return {0, key[0]}; } void program_pulibot() { for (int _m = 0; _m <= Z; _m++) { for (int _w = -2; _w <= Z; _w++) { for (int _s = -2; _s <= Z; _s++) { for (int _e = -2; _e <= Z; _e++) { for (int _n = -2; _n <= Z; _n++) { vector<int> S({_m, _w, _s, _e, _n}); auto [Z, A] = solve(S); set_instruction(S, Z, A); } } } } } }
#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...