#include "robot.h"
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T, typename key = less<T>>
using ordered_set = tree<T, null_type, key, rb_tree_tag, tree_order_statistics_node_update>;
void program_pulibot() {
vector<int> v = { -2, -1, 0, 1, 2, 3, 4, 5 };
vector<int> S(5);
auto mv = [&](int c) -> char {
if (c == 2) return 'W';
if (c == 3) return 'S';
if (c == 4) return 'E';
return 'N';
};
for (int s0 : v)
for (int s1 : v)
for (int s2 : v)
for (int s3 : v)
for (int s4 : v) {
S[0] = s0; S[1] = s1; S[2] = s2; S[3] = s3; S[4] = s4;
if (s0 == 0) {
bool ok = false;
for (int d = 0; d < 4; d++) {
if (S[d + 1] == 0) {
set_instruction(S, 2 + d, mv(2 + d));
ok = true;
break;
}
}
if (ok) continue;
if (s2 == -2 && s3 == -2) {
set_instruction(S, 1, 'T');
continue;
}
for (int d = 0; d < 4; d++) {
int opp = 2 + (d ^ 1);
if (S[d + 1] == opp) {
set_instruction(S, 1, mv(opp));
ok = true;
break;
}
}
if (ok) continue;
}
if (s0 >= 2 && s0 <= 5) {
set_instruction(S, 1, mv(s0));
continue;
}
set_instruction(S, 0, 'H');
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |