Submission #841524

#TimeUsernameProblemLanguageResultExecution timeMemory
841524model_codeRobot Contest (IOI23_robot)C++17
26 / 100
170 ms10068 KiB
// correct/BM_2direction.cpp /* colors.txt: #ffffff 0 #0060ff 1 #ff0000 ^ #ff0000 < #005500 ^ #005500 < #ffff00 ^ #ffff00 < */ #include "robot.h" #include <map> #include <algorithm> #define ANY -3 #define UP 2 #define LEFT 3 #define BADUP 4 #define BADLEFT 5 #define TEMPUP 6 #define TEMPLEFT 7 int colorMax = 7; std::map<int, std::pair<int, char>> insts; std::pair<int, int> range(int x) { if (x == -3) return {-2, colorMax}; return {x, x}; } void map_instruction(const std::vector<int> &vec, int Z, char A) { int p = 0; for (int i : vec) p = 30 * p + i + 2; insts[p] = {Z, A}; } void instruct(const std::vector<int> &vec, int Z, char A) { for (int i0 = range(vec[0]).first; i0 <= range(vec[0]).second; i0++) { for (int i1 = range(vec[1]).first; i1 <= range(vec[1]).second; i1++) { for (int i2 = range(vec[2]).first; i2 <= range(vec[2]).second; i2++) { for (int i3 = range(vec[3]).first; i3 <= range(vec[3]).second; i3++) { for (int i4 = range(vec[4]).first; i4 <= range(vec[4]).second; i4++) { map_instruction({i0, i1, i2, i3, i4}, Z, A); } } } } } } void program_pulibot() { instruct({0, UP, ANY, ANY, ANY}, LEFT, 'H'); instruct({0, LEFT, ANY, ANY, ANY}, LEFT, 'H'); instruct({0, ANY, ANY, ANY, UP}, UP, 'H'); instruct({0, ANY, ANY, ANY, LEFT}, UP, 'H'); instruct({0, -2, ANY, ANY, -2}, UP, 'H'); instruct({UP, ANY, ANY, ANY, ANY}, BADUP, 'N'); instruct({LEFT, ANY, ANY, ANY, ANY}, BADLEFT, 'W'); instruct({UP, ANY, 0, ANY, ANY}, UP, 'S'); instruct({UP, ANY, ANY, 0, ANY}, UP, 'E'); instruct({LEFT, ANY, 0, ANY, ANY}, LEFT, 'S'); instruct({LEFT, ANY, ANY, 0, ANY}, LEFT, 'E'); instruct({UP, ANY, -2, -2, ANY}, TEMPLEFT, 'H'); instruct({LEFT, ANY, -2, -2, ANY}, TEMPLEFT, 'H'); instruct({TEMPLEFT, ANY, ANY, ANY, ANY}, 1, 'H'); instruct({TEMPLEFT, TEMPLEFT, ANY, ANY, ANY}, 0, 'W'); instruct({TEMPLEFT, TEMPUP, ANY, ANY, ANY}, 0, 'W'); instruct({TEMPUP, ANY, ANY, ANY, TEMPLEFT}, 0, 'N'); instruct({TEMPUP, ANY, ANY, ANY, TEMPUP}, 0, 'N'); instruct({TEMPLEFT, ANY, BADUP, ANY, ANY}, TEMPLEFT, 'S'); instruct({TEMPLEFT, ANY, ANY, BADLEFT, ANY}, TEMPLEFT, 'E'); instruct({TEMPUP, ANY, BADUP, ANY, ANY}, TEMPUP, 'S'); instruct({TEMPUP, ANY, ANY, BADLEFT, ANY}, TEMPUP, 'E'); instruct({BADLEFT, ANY, ANY, ANY, ANY}, TEMPLEFT, 'H'); instruct({BADUP, ANY, ANY, ANY, ANY}, TEMPUP, 'H'); instruct({1, UP, ANY, ANY, ANY}, 1, 'W'); instruct({1, LEFT, ANY, ANY, ANY}, 1, 'W'); instruct({1, ANY, ANY, ANY, UP}, 1, 'N'); instruct({1, ANY, ANY, ANY, LEFT}, 1, 'N'); instruct({1, -2, ANY, ANY, -2}, 1, 'T'); instruct({UP, ANY, 1, ANY, ANY}, TEMPLEFT, 'H'); instruct({UP, ANY, ANY, 1, ANY}, TEMPLEFT, 'H'); instruct({LEFT, ANY, 1, ANY, ANY}, TEMPLEFT, 'H'); instruct({LEFT, ANY, ANY, 1, ANY}, TEMPLEFT, 'H'); std::vector<int> vec; for (std::pair<int, std::pair<int, char>> i : insts) { vec.clear(); for (int j = 0; j < 5; j++) { vec.push_back(i.first % 30 - 2); i.first /= 30; } std::reverse(vec.begin(), vec.end()); set_instruction(vec, i.second.first, i.second.second); } }
#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...