제출 #1188328

#제출 시각아이디문제언어결과실행 시간메모리
1188328MatteoArcari로봇 대회 (IOI23_robot)C++20
15 / 100
71 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({{0}, all, {-2}, {-2}, all}, 1, 'T');

    gen_instruction({{0, 1}, {0}, all, all, all}, 1, 'W');
    gen_instruction({{0, 1}, all, {0}, all, all}, 1, 'S');
    gen_instruction({{0, 1}, all, all, {0}, all}, 1, 'E');
    gen_instruction({{0, 1}, all, all, all, {0}}, 1, 'N');

    gen_instruction({{0, 1}, {1}, all, all, all}, 2, 'W');
    gen_instruction({{0, 1}, all, {1}, all, all}, 2, 'S');
    gen_instruction({{0, 1}, all, all, {1}, all}, 2, 'E');
    gen_instruction({{0, 1}, all, all, all, {1}}, 2, '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...