Submission #1134253

#TimeUsernameProblemLanguageResultExecution timeMemory
1134253ThanhsNavigation 2 (JOI21_navigation2)C++20
0 / 100
0 ms828 KiB
#include <bits/stdc++.h> #include "Anna.h" using namespace std; #define name "TENBAI" #define fi first #define se second // #define int unsigned long long #define endl '\n' #define setmin(x, y) x = min((x), (y)) #define setmax(x, y) x = max((x), (y)) #define sqr(x) ((x) * (x)) mt19937_64 hdp(10); int rand(int l, int r){return l + ((hdp() % (r - l + 1)) + r - l + 1) % (r - l + 1);} const int NM = 1e6 + 5; int n; bool check(int x, int y) { return x >= 0 && x < n && y >= 0 && y < n; } int f(int x, int y) { return (x % 3) * 3 + y % 3; } void Anna(int N, int K, vector<int> R, vector<int> C) { int F[7][N][N]; n = N; for (int i = 0; i < 7; i++) { int cnt = 0; for (int j = -1; j <= 1; j++) for (int k = -1; k <= 1; k++) { cnt++; if (check(R[i] + j, C[i] + k)) F[i][R[i] + j][C[i] + k] = cnt; } for (int j = 0; j < n; j++) for (int k = 0; k < n; k++) if (!F[i][j][k]) { if (k < C[i] - 1) F[i][j][k] = 13; else if (k > C[i] + 1) F[i][j][k] = 10; else if (j < R[i] - 1) F[i][j][k] = 11; else F[i][j][k] = 12; } } for (int x = 0; x < 3; x++) for (int y = 0; y < 3; y++) { vector<int> b(10, 0); bool chet = 0; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) if (((f(i, j) + f(x, y) + 1) % 9) < 7) { int t = F[(f(i, j) + f(x, y) + 1) % 9][i][j]; if (t == 9) chet = 1; else if (t <= 9) b[t] = 1; } if (chet) break; int mex = 1; while (b[mex]) mex++; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) { int t1 = (f(i, j) + f(x, y) + 1) % 9; if (t1 < 7) SetFlag(i, j, F[t1][i][j] - (F[t1][i][j] > mex)); else if (t1 == 7) SetFlag(i, j, mex); else SetFlag(i, j, 12); } return; } }
#include <bits/stdc++.h> #include "Bruno.h" using namespace std; #define name "TENBAI" #define fi first #define se second // #define int unsigned long long #define endl '\n' #define setmin(x, y) x = min((x), (y)) #define setmax(x, y) x = max((x), (y)) #define sqr(x) ((x) * (x)) mt19937_64 hdp(10); int rand(int l, int r){return l + ((hdp() % (r - l + 1)) + r - l + 1) % (r - l + 1);} const int NM = 1e6 + 5; int n; bool check(int x, int y) { return x >= 0 && x < n && y >= 0 && y < n; } int f(int x, int y) { return (x % 3) * 3 + y % 3; } int answer(int pos, int val) { if (val == 10) return 1; if (val == 11) return 2; if (val == 12) return 3; if (val == 13) return 0; if (val - 1 == pos) return 5; pair<int, int> Pos = {pos / 3, pos % 3}; if (Pos.fi == 2) Pos.fi = -1; if (Pos.se == 2) Pos.se = -1; if (val / 3 == 0) Pos.fi++; if (val / 3 == 2) Pos.fi--; if (val % 3 == 0) Pos.se++; if (val % 3 == 2) Pos.se--; if (Pos.fi < 0) return 2; if (Pos.se > 0) return 3; if (Pos.se < 0) return 0; else return 1; } vector<int> Bruno(int K, vector<int> value) { vector<int> ans; int mx = max_element(value.begin(), value.end()) - value.begin(); int mex = value[(mx + 8) % 9]; for (int i = 0; i < 9; i++) { value[i] += (value[i] >= mex); int t = (i + mx + 1) % 9; ans[t] = answer(i, value[i]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...