Submission #1211333

#TimeUsernameProblemLanguageResultExecution timeMemory
1211333omsincoconutRobot Contest (IOI23_robot)C++17
25 / 100
68 ms5704 KiB
#include "robot.h"

#include "bits/stdc++.h"
using namespace std;

void program_pulibot() {
    vector<int> all = {-2, -1, 0, 1, 2};
    vector<int> nonzero = {-2, -1, 1, 2};
    vector<int> nonone = {-2, -1, 2};

    // DFS
    // East
    for (int i1 : all) for (int i2 : all) for (int i3 : all) for (int i4 : all) {
        set_instruction({i1, i2, i3, 0, i4}, 1, 'E');
    }

    // South
    for (int i1 : all) for (int i2 : all) for (int i3 : nonzero) for (int i4 : all) {
        set_instruction({i1, i2, 0, i3, i4}, 1, 'S');
    }

    // West
    for (int i1 : all) for (int i2 : nonzero) for (int i3 : nonzero) for (int i4 : all) {
        if (i2 != -2 || i3 != -2) set_instruction({i1, 0, i2, i3, i4}, 1, 'W');
    }

    // North
    for (int i1 : all) for (int i2 : nonzero) for (int i3 : nonzero) for (int i4 : nonzero) {
        if (i3 != -2 || i4 != -2) set_instruction({i1, i2, i3, i4, 0}, 1, 'N');
    }

    // Fill path when cannot
    // East
    for (int i1 : all) for (int i2 : nonzero) for (int i3 : nonzero) for (int i4 : nonzero) {
        set_instruction({i1, i2, i3, 1, i4}, 2, 'E');
    }

    // South
    for (int i1 : all) for (int i2 : nonzero) for (int i3 : nonone) for (int i4 : nonzero) {
        set_instruction({i1, i2, 1, i3, i4}, 2, 'S');
    }

    // West
    for (int i1 : all) for (int i2 : nonone) for (int i3 : nonone) for (int i4 : nonzero) {
        if (i2 != -2 || i3 != -2) set_instruction({i1, 1, i2, i3, i4}, 2, 'W');
    }

    // North
    for (int i1 : all) for (int i2 : nonone) for (int i3 : nonone) for (int i4 : nonone) {
        if (i3 != -2 || i4 != -2) set_instruction({i1, i2, i3, i4, 1}, 2, 'N');
    }

    // Termination
    for (int i1 : all) for (int i2 : all) for (int i3 : all) {
        set_instruction({i1, i2, -2, -2, i3}, 1, 'T');
    }
}

#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...