제출 #1040228

#제출 시각아이디문제언어결과실행 시간메모리
1040228Zicrus로봇 대회 (IOI23_robot)C++17
24 / 100
90 ms7316 KiB
#include <bits/stdc++.h>
#include "robot.h"
using namespace std;

typedef long long ll;

// Cur, W, S, E, N

unordered_set<ll> check;

void instruct(vector<int> s, int z, char a, bool exp = false) {
    vector<int> nw;
    vector<vector<int>> scenarios(1, vector<int>(5));
    for (int i = 0; i < 5; i++) {
        scenarios[0][i] = s[i] == -9 ? -2 : s[i];
    }
    for (int i = 0; i < 5; i++) {
        ll sz = scenarios.size();
        if (s[i] == -1 && !exp) {
            for (int j = 0; j < sz; j++) {
                nw = scenarios[j];
                nw[i] = -2;
                scenarios.push_back(nw);
                nw[i] = 2;
                scenarios.push_back(nw);
            }
        }
        if (s[i] == -9) {
            for (int j = 0; j < sz; j++) {
                nw = scenarios[j];
                nw[i] = -1;
                scenarios.push_back(nw);
                nw[i] = 0;
                scenarios.push_back(nw);
                nw[i] = 1;
                scenarios.push_back(nw);
                nw[i] = 2;
                scenarios.push_back(nw);
                nw[i] = 3;
                scenarios.push_back(nw);
                nw[i] = 4;
                scenarios.push_back(nw);
            }
        }
    }

    for (auto &e : scenarios) {
        ll id = ((e[0] & 15) << (4 * 4)) | ((e[1] & 15) << (4 * 3)) | ((e[2] & 15) << (4 * 2)) | ((e[3] & 15) << (4 * 1)) | ((e[4] & 15) << (4 * 0));
        if (check.count(id)) continue;
        check.insert(id);
        set_instruction(e, z, a);
    }
}

// Cur, W, S, E, N

// 1 - Result & Eraser
// 2 - Trail
// 3 - Repellant

void program_pulibot() {
    instruct({1, -2, 1, 0, -2}, 1, 'T');
    instruct({1, -2, 1, -1, -2}, 1, 'T');
    instruct({1, -2, 0, 1, -2}, 1, 'T');
    instruct({1, -2, -1, 1, -2}, 1, 'T');
    instruct({2, -9, -2, -2, -9}, 1, 'H');

    // -------------------------------- 1

    // Go to repellant
    instruct({1, 3, -9, -9, -9}, 1, 'W');
    instruct({1, -9, 3, -9, -9}, 1, 'S');
    instruct({1, -9, -9, 3, -9}, 1, 'E');
    instruct({1, -9, -9, -9, 3}, 1, 'N');

    // Go to trail
    instruct({1, 2, -9, -9, -9}, 1, 'W');
    instruct({1, -9, 2, -9, -9}, 1, 'S');
    instruct({1, -9, -9, 2, -9}, 1, 'E');
    instruct({1, -9, -9, -9, 2}, 1, 'N');

    // Go back and erase
    instruct({1, 1, -9, -9, -9}, 0, 'W');
    instruct({1, -9, 1, -9, -9}, 0, 'S');
    instruct({1, -9, -9, 1, -9}, 0, 'E');
    instruct({1, -9, -9, -9, 1}, 0, 'N');

    // SET STATE
    instruct({-9, 1, -9, -9, -9}, 1, 'H');
    instruct({-9, -9, 1, -9, -9}, 1, 'H');
    instruct({-9, -9, -9, 1, -9}, 1, 'H');
    instruct({-9, -9, -9, -9, 1}, 1, 'H');

    // -------------------------------- 2

    // Explore empty
    instruct({2, 0, -9, -9, -9}, 2, 'W');
    instruct({2, -9, 0, -9, -9}, 2, 'S');
    instruct({2, -9, -9, 0, -9}, 2, 'E');
    instruct({2, -9, -9, -9, 0}, 2, 'N');

    // Go back and repel
    instruct({2, 2, -9, -9, -9}, 3, 'W');
    instruct({2, -9, 2, -9, -9}, 3, 'S');
    instruct({2, -9, -9, 2, -9}, 3, 'E');
    instruct({2, -9, -9, -9, 2}, 3, 'N');

    // SET STATE
    instruct({-9, 2, -9, -9, -9}, 2, 'H');
    instruct({-9, -9, 2, -9, -9}, 2, 'H');
    instruct({-9, -9, -9, 2, -9}, 2, 'H');
    instruct({-9, -9, -9, -9, 2}, 2, 'H');
    instruct({-9, -9, -9, -9, -9}, 2, 'H');
}

// Cur, W, S, E, N

// 1 - Result & Eraser
// 2 - Trail
// 3 - Repellant
#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...