Submission #1158743

#TimeUsernameProblemLanguageResultExecution timeMemory
1158743The_SamuraiRobot Contest (IOI23_robot)C++20
15 / 100
66 ms5632 KiB
#include "robot.h"
#include "bits/stdc++.h"
using namespace std;
pair<int, char> bad = make_pair(-1, 'A');
vector<char> ord = {'W', 'S', 'E', 'N'};
vector<char> iord = {'E', 'N', 'W', 'S'};

pair<int, char> get(int now, int w, int s, int e, int n) {
    if (s == -2 and e == -2) return make_pair(1, 'T');
    vector<int> vec = {w, s, e, n};
    // if (count(vec.begin(), vec.end(), 1) > 1) return bad;
    if (count(vec.begin(), vec.end(), 1) == 0) {
        if (w != -2 or n != -2) return bad;
    }
    // if (now == 0 and w == -1 and s == -2 and e == -1) {
    //     cout << now << ' ' << w << ' ' << s << ' ' << e << ' ' << n << endl;
    // }
    for (int i = 0; i < vec.size(); i++) {
        if (vec[i] == 0) return make_pair(1, ord[i]);
    }
    for (int i = 0; i < vec.size(); i++) {
        int j = find(ord.begin(), ord.end(), iord[i]) - ord.begin();
        if (vec[j] == 1) return make_pair(2, iord[i]);
    }
    return bad;
}

void program_pulibot()
{
    bool found = false;
    for (int now = 0; now <= 1; now++) {
        for (int w = -2; w <= 2; w++) {
            for (int s = -2; s <= 2; s++) {
                for (int e = -2; e <= 2; e++) {
                    for (int n = -2; n <= 2; n++) {
                        auto it = get(now, w, s, e, n);
                        if (it.first == -1) continue;
                        found |= vector{0, -1, -2, -1, 1} == vector{now, w, s, e, n};
                        set_instruction({now, w, s, e, n}, it.first, it.second);
                    }
                }
            }
        }
    }
    // cout << found << endl;
}
#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...