제출 #842717

#제출 시각아이디문제언어결과실행 시간메모리
842717kirill_iceland로봇 대회 (IOI23_robot)C++17
100 / 100
178 ms10700 KiB
#include "robot.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for(int i = a; i < b; i++) typedef vector<int> vi; map<vi, bool> mem; void set_instruction_(std::vector<int> S, int Z, char A){ if(mem.find(S) != mem.end()) return; set_instruction(S, Z, A); mem[S] = true; return; } void program_pulibot() { // 0: white, 1: blue, 2: red, 3: <, 4: v, 5: >, 6: ^ // start set_instruction_({0, -2, 0, 0, -2}, 1, 'E'); set_instruction_({0, -2, -1, 0, -2}, 1, 'E'); set_instruction_({0, -2, 0, -1, -2}, 1, 'S'); // restart rep(i, 3, 7){ rep(j, 3, 7){ set_instruction_({1, -2, i, j, -2}, 2, 'E'); } set_instruction_({1, -2, -1, i, -2}, 2, 'E'); set_instruction_({1, -2, i, -1, -2}, 2, 'S'); } // end rep(i, 3, 7){ rep(j, -2, 7){ if(j == 2) continue; set_instruction_({i, 2, -2, -2, j}, 1, 'W'); set_instruction_({i, j, -2, -2, 2}, 1, 'N'); } } // termenate rep(j, -2, 3){ if(j == 1) continue; // set_instruction_({2, -2, 1, j, -2}, 1, 'T'); // set_instruction_({2, -2, j, 1, -2}, 1, 'T'); set_instruction_({1, -2, 1, j, -2}, 1, 'T'); set_instruction_({1, -2, j, 1, -2}, 1, 'T'); } set_instruction_({2, -2, 1, -1, -2}, 1, 'T'); set_instruction_({2, -2, -1, 1, -2}, 1, 'T'); // on white next to blue: go blue, leave arrow // go east rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ if(k == 1 || j == 1 || i == 1) continue; set_instruction_({0, j, i, 1, k}, 5, 'E'); } } } // go south rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ if(k == 1 || j == 1 || i == 1) continue; set_instruction_({0, i, 1, j, k}, 4, 'S'); } } } // go west rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ if(k == 1 || j == 1 || i == 1) continue; set_instruction_({0, 1, i, j, k}, 3, 'W'); } } } // go north rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ if(k == 1 || j == 1 || i == 1) continue; set_instruction_({0, k, i, j, 1}, 6, 'N'); } } } // on blue next to white // go east rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ // if(k == 0 || j == 0 || i == 0) continue; if(i == 1 || j == 1 || k == 1) continue; set_instruction_({1, j, i, 0, k}, 1, 'E'); } } } // go south rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ if(i == 0) continue; if(i == 1 || j == 1 || k == 1) continue; set_instruction_({1, j, 0, i, k}, 1, 'S'); } } } // go west rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ if(j == 0 || i == 0) continue; if(i == 1 || j == 1 || k == 1) continue; set_instruction_({1, 0, i, j, k}, 1, 'W'); } } } // go north rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ if(k == 0 || j == 0 || i == 0) continue; if(i == 1 || j == 1 || k == 1) continue; set_instruction_({1, j, i, k, 0}, 1, 'N'); } } } // on arrow next to red rep(i, 3, 7){ rep(j, -2, 7){ rep(k, -2, 7){ if(k == 2 || j == 2) continue; // east set_instruction_({i, k, j, 0, 2}, 1, 'E'); set_instruction_({i, k, j, 3, 2}, 2, 'E'); set_instruction_({i, k, 2, 0, j}, 1, 'E'); set_instruction_({i, k, 2, 3, j}, 2, 'E'); set_instruction_({i, 2, k, 0, j}, 1, 'E'); set_instruction_({i, 2, k, 3, j}, 2, 'E'); // south set_instruction_({i, k, 0, 2, j}, 1, 'S'); set_instruction_({i, k, 6, 2, j}, 2, 'S'); if(j != 0 && j != 3){ set_instruction_({i, k, 0, j, 2}, 1, 'S'); set_instruction_({i, k, 6, j, 2}, 2, 'S'); set_instruction_({i, 2, 0, j, k}, 1, 'S'); set_instruction_({i, 2, 6, j, k}, 2, 'S'); } // west if(k != 0 && k != 6){ set_instruction_({i, 0, k, 2, j}, 1, 'W'); set_instruction_({i, 5, k, 2, j}, 2, 'W'); } if(j != 0 && j != 3){ if(k != 0 && k != 6){ set_instruction_({i, 0, k, j, 2}, 1, 'W'); set_instruction_({i, 5, k, j, 2}, 2, 'W'); } set_instruction_({i, 0, 2, j, k}, 1, 'W'); set_instruction_({i, 5, 2, j, k}, 2, 'W'); } // west if(j != 0 && k != 0){ if(k != 5){ if(j != 3){ set_instruction_({i, k, 2, j, 0}, 1, 'N'); set_instruction_({i, k, 2, j, 4}, 2, 'N'); } if(j != 6){ set_instruction_({i, k, j, 2, 0}, 1, 'N'); set_instruction_({i, k, j, 2, 4}, 2, 'N'); } } if(j != 6 && k != 3){ set_instruction_({i, 2, j, k, 0}, 1, 'N'); set_instruction_({i, 2, j, k, 4}, 2, 'N'); } } } } } // on white next to red rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ if(k == 2 || j == 2 || i == 2) continue; if(k == 1 || j == 1 || i == 1) continue; set_instruction_({0, k, j, 2, i}, 5, 'E'); set_instruction_({0, k, 2, j, i}, 4, 'S'); set_instruction_({0, 2, k, j, i}, 3, 'W'); set_instruction_({0, k, i, j, 2}, 6, 'N'); } } } // on red with no arrows arround rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ rep(l, -2, 7){ if(k == 1 || j == 1|| i == 1 || l == 1) continue; set_instruction_({2, 1, l, 0, j}, 2, 'E'); set_instruction_({2, k, 1, 0, j}, 2, 'E'); set_instruction_({2, k, l, 0, 1}, 2, 'E'); set_instruction_({2, 1, 0, i, j}, 2, 'S'); set_instruction_({2, k, 0, 1, j}, 2, 'S'); set_instruction_({2, k, 0, i, 1}, 2, 'S'); set_instruction_({2, 0, 1, i, j}, 2, 'W'); set_instruction_({2, 0, l, 1, j}, 2, 'W'); set_instruction_({2, 0, l, i, 1}, 2, 'W'); set_instruction_({2, 1, l, i, 0}, 2, 'N'); set_instruction_({2, k, 1, i, 0}, 2, 'N'); set_instruction_({2, k, l, 1, 0}, 2, 'N'); if(k == 5 || j == 4|| i == 3 || l == 6) continue; set_instruction_({2, k, l, 0, j}, 1, 'E'); set_instruction_({2, k, 0, i, j}, 1, 'S'); set_instruction_({2, 0, l, i, j}, 1, 'W'); set_instruction_({2, k, l, i, 0}, 1, 'N'); // with blue if(i != 0 && k != 0 && j != 0 && l != 0){ set_instruction_({2, 1, l, 2, j}, 1, 'E'); set_instruction_({2, k, 1, 2, j}, 1, 'E'); set_instruction_({2, k, l, 2, 1}, 1, 'E'); set_instruction_({2, 1, 2, i, j}, 1, 'S'); set_instruction_({2, k, 2, 1, j}, 1, 'S'); set_instruction_({2, k, 2, i, 1}, 1, 'S'); set_instruction_({2, 2, 1, i, j}, 1, 'W'); set_instruction_({2, 2, l, 1, j}, 1, 'W'); set_instruction_({2, 2, l, i, 1}, 1, 'W'); set_instruction_({2, 1, l, i, 2}, 1, 'N'); set_instruction_({2, k, 1, i, 2}, 1, 'N'); set_instruction_({2, k, l, 1, 2}, 1, 'N'); } } } } } // on blue next to red rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ if(k == 2 || j == 2 || i == 2) continue; if(k == 1 || j == 1 || i == 1) continue; set_instruction_({1, k, j, 2, i}, 0, 'E'); set_instruction_({1, k, 2, j, i}, 0, 'S'); set_instruction_({1, 2, k, j, i}, 0, 'W'); set_instruction_({1, k, i, j, 2}, 0, 'N'); } } } // on red with arrows arround rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ rep(l, -2, 7){ if(k == 1 || j == 1|| i == 1 || l == 1) continue; // if(k == 5 || j == 4|| i == 3 || l == 6) continue; set_instruction_({2, k, l, 3, j}, 2, 'E'); set_instruction_({2, k, 6, i, j}, 2, 'S'); set_instruction_({2, 5, l, i, j}, 2, 'W'); set_instruction_({2, k, l, i, 4}, 2, 'N'); } } } } // on arrow next to red and wall rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ if(k == 2 || j == 2 || i == 2) continue; if(k == 1 || j == 1 || i == 1) continue; if(k == 0 || j == 0 || i == 0) continue; // if(k == 5 || j == 4|| i == 3 || l == 6) continue; set_instruction_({5, k, j, 2, i}, 0, 'E'); set_instruction_({4, k, 2, j, i}, 0, 'S'); set_instruction_({3, 2, k, j, i}, 0, 'W'); set_instruction_({6, k, i, j, 2}, 0, 'N'); } } } // on arrow with arrows arround rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ rep(l, -2, 7){ rep(m, 3, 7){ // if(k == 1 || j == 1|| i == 1 || l == 1) continue; // if(k == 5 || j == 4|| i == 3 || l == 6) continue; set_instruction_({m, k, l, 3, j}, m, 'E'); set_instruction_({m, k, 6, i, j}, m, 'S'); set_instruction_({m, 5, l, i, j}, m, 'W'); set_instruction_({m, k, l, i, 4}, m, 'N'); } } } } } // on arrow with no arrows arround rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ rep(l, -2, 7){ // if(k == 1 || j == 1|| i == 1 || l == 1) continue; if(k == 5 || j == 4|| i == 3 || l == 6) continue; set_instruction_({5, k, l, i, j}, 0, 'E'); set_instruction_({4, k, l, i, j}, 0, 'S'); set_instruction_({3, k, l, i, j}, 0, 'W'); set_instruction_({6, k, l, i, j}, 0, 'N'); } } } } // on red or blue with arrows arround and blue rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ rep(l, -2, 7){ if(k == 1 || j == 1|| i == 1 || l == 1) continue; // if(k == 5 || j == 4|| i == 3 || l == 6) continue; set_instruction_({2, 1, l, 3, j}, 1, 'E'); set_instruction_({2, k, 1, 3, j}, 1, 'E'); set_instruction_({2, k, l, 3, 1}, 1, 'E'); set_instruction_({2, 1, 6, i, j}, 1, 'S'); set_instruction_({2, k, 6, 1, j}, 1, 'S'); set_instruction_({2, k, 6, i, 1}, 1, 'S'); set_instruction_({2, 5, 1, i, j}, 1, 'W'); set_instruction_({2, 5, l, 1, j}, 1, 'W'); set_instruction_({2, 5, l, i, 1}, 1, 'W'); set_instruction_({2, 1, l, i, 4}, 1, 'N'); set_instruction_({2, k, 1, i, 4}, 1, 'N'); set_instruction_({2, k, l, 1, 4}, 1, 'N'); // on blue set_instruction_({1, 1, l, 3, j}, 1, 'E'); set_instruction_({1, k, 1, 3, j}, 1, 'E'); set_instruction_({1, k, l, 3, 1}, 1, 'E'); set_instruction_({1, 1, 6, i, j}, 1, 'S'); set_instruction_({1, k, 6, 1, j}, 1, 'S'); set_instruction_({1, k, 6, i, 1}, 1, 'S'); set_instruction_({1, 5, 1, i, j}, 1, 'W'); set_instruction_({1, 5, l, 1, j}, 1, 'W'); set_instruction_({1, 5, l, i, 1}, 1, 'W'); set_instruction_({1, 1, l, i, 4}, 1, 'N'); set_instruction_({1, k, 1, i, 4}, 1, 'N'); set_instruction_({1, k, l, 1, 4}, 1, 'N'); } } } } // on blue with no arrows arround rep(i, -2, 7){ rep(j, -2, 7){ rep(k, -2, 7){ rep(l, -2, 7){ if(k == 1 || j == 1|| i == 1 || l == 1) continue; if(k == 5 || j == 4|| i == 3 || l == 6) continue; // with blue set_instruction_({1, 1, l, 2, j}, 1, 'E'); set_instruction_({1, k, 1, 2, j}, 1, 'E'); set_instruction_({1, k, l, 2, 1}, 1, 'E'); set_instruction_({1, 1, 2, i, j}, 1, 'S'); set_instruction_({1, k, 2, 1, j}, 1, 'S'); set_instruction_({1, k, 2, i, 1}, 1, 'S'); set_instruction_({1, 2, 1, i, j}, 1, 'W'); set_instruction_({1, 2, l, 1, j}, 1, 'W'); set_instruction_({1, 2, l, i, 1}, 1, 'W'); set_instruction_({1, 1, l, i, 2}, 1, 'N'); set_instruction_({1, k, 1, i, 2}, 1, 'N'); set_instruction_({1, k, l, 1, 2}, 1, 'N'); } } } } }
#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...