제출 #1188323

#제출 시각아이디문제언어결과실행 시간메모리
1188323MatteoArcari로봇 대회 (IOI23_robot)C++20
6 / 100
69 ms5704 KiB
#include "robot.h" #include <bits/stdc++.h> using namespace std; const int MAX_COLOR = 19; static int encode_state(const std::vector<int> &S) { int state = 0; for (int s : S) { state = (MAX_COLOR + 3) * state + s + 2; } return state; } map<int, int> used; void set_instruction(vector<int> S, int Z, char A); // {o < v > ^} vector<int> s(5); vector<int> all = {-1, -2, 0, 1, 2}; vector<int> nop = {-1, -2, 1}; vector<int> def = {-1, -2, 0}; void gen_instruction(vector<vector<int>> ps, int z, char a, int i = 0) { if (i == 5) { if (used[encode_state(s)]) return; used[encode_state(s)] = 1; set_instruction(s, z, a); return; } for (int inst: ps[i]) { s[i] = inst; gen_instruction(ps, z, a, i + 1); } } void program_pulibot() { gen_instruction({{1, 2}, {-2}, def, {1}, {-2}}, 1, 'T'); gen_instruction({{1, 2}, {-2}, {1}, def, {-2}}, 1, 'T'); gen_instruction({{0}, all, {0}, {0}, all}, 2, 'S'); gen_instruction({{2}, all, {0}, {0}, all}, 1, 'E'); gen_instruction({{0}, all, {0}, nop, all}, 1, 'S'); gen_instruction({{0}, all, nop, {0}, all}, 1, 'E'); // path found gen_instruction({{0}, def, {-2}, {-2}, {1, 2}}, 1, 'N'); gen_instruction({{0}, {1, 2}, {-2}, {-2}, def}, 1, 'W'); // blocked gen_instruction({{0}, def, nop, nop, {1, 2}}, 0, 'N'); gen_instruction({{0}, {1, 2}, nop, nop, def}, 0, 'W'); // back with path gen_instruction({{1, 2}, all, {1}, def, {1, 2}}, 1, 'N'); gen_instruction({{1, 2}, all, def, {1}, {1, 2}}, 1, 'N'); gen_instruction({{1, 2}, {1, 2}, {1}, def, all}, 1, 'W'); gen_instruction({{1, 2}, {1, 2}, def, {1}, all}, 1, 'W'); // back no path gen_instruction({{1}, all, {0}, nop, {1, 2}}, 0, 'N'); gen_instruction({{1}, all, nop, {0}, {1, 2}}, 0, 'N'); gen_instruction({{1}, all, {0}, {0}, {1, 2}}, 0, 'N'); gen_instruction({{1}, {1, 2}, {0}, nop, all}, 0, 'W'); gen_instruction({{1}, {1, 2}, nop, {0}, all}, 0, 'W'); gen_instruction({{1}, {1, 2}, {0}, {0}, all}, 0, 'W'); }
#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...