제출 #1219872

#제출 시각아이디문제언어결과실행 시간메모리
1219872madamadam3로봇 대회 (IOI23_robot)C++20
10 / 100
103 ms5592 KiB
#include "robot.h" #include <bits/stdc++.h> using namespace std; /* boundary: state = -2 obstacle: state = -1 otherwise: state = colour n = up, s = down, w = left, e = right S[0] is the state of cell (r, c). S[1] is the state of the cell to the west. S[2] is the state of the cell to the south. S[3] is the state of the cell to the east. S[4] is the state of the cell to the north. */ set<string> instr; void instruction(vector<int> S, int Z, char A) { set_instruction(S, Z, A); string val = ""; for (auto &el : S) val += to_string(el) + " "; // val += to_string(Z); // if (instr.count(val)) { // cout << "Duplicate with: \n"; // cout << val << "\n"; // } else { // instr.insert(val); // } } void solve_empty() { // if its entirely empty: go right while not a border on the right, then go up // if instruction({0, -2, 0, 0, -2}, 1, 'E'); // at (0, 0): go right instruction({0, 1, 0, 0, -2}, 1, 'E'); // travelling along bottom: go right instruction({0, 1, 0, -2, -2}, 1, 'S'); // at (W, 0): go down instruction({0, 0, 0, -2, 1}, 1, 'S'); // travelling along side: go down instruction({0, 0, -2, -2, 1}, 1, 'T'); // at (W, H): terminate } void solve_h2() { // while possible, walk right // if not possible, go down/up // if at (W, H-1), go up // go right while possible for (auto &west_state : {-2, -1, 0, 1}) { for (auto &south_state : {-2, -1, 0, 1}) { for (auto &north_state : {-2, -1, 0, 1}) { instruction({0, west_state, south_state, 0, north_state}, 1, 'E'); } } } // go down when needed for (auto &east_state : {-2, -1}) { for (auto &west_state : {-2, 1}) { instruction({0, west_state, 0, east_state, -2}, 1, 'S'); } } // go up when needed for (auto &east_state : {-1}) { for (auto &west_state : {-2, 1}) { instruction({0, west_state, -2, east_state, 0}, 1, 'N'); } } // at end for (auto &west_state : {-2, -1, 0, 1}) { for (auto &north_state : {-1, 0, 1}) { instruction({0, west_state, -2, -2, north_state}, 1, 'T'); } } } void program_pulibot() { // solve_empty(); solve_h2(); }
#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...