Submission #1157584

#TimeUsernameProblemLanguageResultExecution timeMemory
1157584thieunguyenhuyRobot Contest (IOI23_robot)C++20
0 / 100
66 ms5704 KiB
#include "robot.h" #include <bits/stdc++.h> using namespace std; #define POPCOUNT(n) (__builtin_popcountll((n))) #define CLZ(n) (__builtin_clzll((n))) #define CTZ(n) (__builtin_ctzll((n))) #define LOG(n) (63 - __builtin_clzll((n))) #define BIT(n, i) (((n) >> (i)) & 1ll) #define MASK(i) (1ll << (i)) #define FLIP(n, i) ((n) ^ (1ll << (i))) #define ON(n, i) ((n) | MASK(i)) #define OFF(n, i) ((n) & ~MASK(i)) #define Int __int128 #define fi first #define se second typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int, int> pii; typedef pair<long long, long long> pll; typedef pair<long long, int> pli; typedef pair<int, long long> pil; typedef vector<pair<int, int>> vii; typedef vector<pair<long long, long long>> vll; typedef vector<pair<long long, int>> vli; typedef vector<pair<int, long long>> vil; template <class T1, class T2> bool maximize(T1 &x, T2 y) { if (x < y) { x = y; return true; } return false; } template <class T1, class T2> bool minimize(T1 &x, T2 y) { if (x > y) { x = y; return true; } return false; } template <class T> void remove_duplicate(vector<T> &ve) { sort (ve.begin(), ve.end()); ve.resize(unique(ve.begin(), ve.end()) - ve.begin()); } mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); template <class T1, class T2> T1 random(T1 l, T2 r) { return uniform_int_distribution<T1>(l, r)(rng); } template <class T> T random(T r) { return rng() % r; } const int N = 1e6 + 5; const int MOD = 1e9 + 7; const int inf = 1e9; const long long INF = 1e18; const int NOT_VIS = -7; const int NOT_WALL = -6; const int VIS = -5; const int NOT_FREE = -4; const int ANY = -3; const int WALL = -2; const int TRAP = -1; const int FREE = 0; void backtrack(int index, vector<int> S, int Z, char A) { if (index == S.size()) { set_instruction(S, Z, A); return; } if (S[index] == VIS) { for (int i = 1; i <= 6; ++i) { S[index] = i; backtrack(index + 1, S, Z, A); } } else if (S[index] == ANY) { for (int i = -2; i <= 6; ++i) { S[index] = i; backtrack(index + 1, S, Z, A); } } else if (S[index] == NOT_FREE) { for (int i = -2; i <= 6; ++i) if (i != FREE) { S[index] = i; backtrack(index + 1, S, Z, A); } } else if (S[index] == NOT_WALL) { for (int i = -2; i <= 6; ++i) if (i != WALL) { S[index] = i; backtrack(index + 1, S, Z, A); } } else if (S[index] == NOT_VIS) { for (int i = -2; i <= 0; ++i) { S[index] = i; backtrack(index + 1, S, Z, A); } } else backtrack(index + 1, S, Z, A); } void add(vector<int> S, int Z, char A) { backtrack(0, S, Z, A); } void program_pulibot() { add({0, FREE, NOT_WALL, ANY, ANY}, 1, 'W'); add({0, FREE, WALL, NOT_WALL, ANY}, 1, 'W'); add({0, NOT_FREE, NOT_WALL, ANY, ANY}, 1, 'H'); add({0, NOT_FREE, WALL, NOT_WALL, ANY}, 1, 'H'); add({1, NOT_FREE, FREE, ANY, ANY}, 2, 'S'); add({1, NOT_FREE, NOT_FREE, ANY, ANY}, 2, 'H'); add({2, NOT_FREE, NOT_FREE, FREE, ANY}, 3, 'E'); add({2, NOT_FREE, NOT_FREE, NOT_FREE, ANY}, 3, 'H'); add({3, NOT_FREE, NOT_FREE, NOT_FREE, FREE}, 4, 'N'); add({3, NOT_FREE, NOT_FREE, NOT_FREE, NOT_FREE}, 4, 'H'); add({4, VIS, NOT_VIS, NOT_VIS, NOT_VIS}, 0, 'W'); add({4, NOT_VIS, VIS, NOT_VIS, NOT_VIS}, 0, 'S'); add({4, NOT_VIS, NOT_VIS, VIS, NOT_VIS}, 0, 'E'); add({4, NOT_VIS, NOT_VIS, NOT_VIS, VIS}, 0, 'N'); add({0, ANY, WALL, WALL, ANY}, 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...