Submission #564507

#TimeUsernameProblemLanguageResultExecution timeMemory
564507DanShadersBroken Device 2 (JOI22_device2)C++17
0 / 100
74 ms3108 KiB
//bs:flags:grader.cpp #include "Anna.h" #include "Bruno.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; namespace x = __gnu_pbds; template <typename T> using ordered_set = x::tree<T, x::null_type, less<T>, x::rb_tree_tag, x::tree_order_statistics_node_update>; template <typename T> using normal_queue = priority_queue<T, vector<T>, greater<>>; #define all(x) begin(x), end(x) #define sz(x) ((int) (x).size()) #define x first #define y second using ll = long long; using ld = long double; int Declare() { return 181; } pair<vector<int>, vector<int>> Anna(ll n) { vector<int> u; for (; n; n /= 2) { u.push_back(n & 1); } vector<int> s = {1}; for (int i : u) { if (i) { s.push_back(s.back() ^ 1); } s.push_back(s.back()); s.push_back(s.back()); } vector<int> t = {1}; while (sz(t) != sz(s)) { t.push_back(t.back() ^ 1); } return {s, t}; } vector<pair<int, int>> path; #define TRY(x) do { if (x) { return true; }} while (false); bool recover(const vector<int> &a, int i, int tlen, int cnt) { if (i == sz(a)) { return 2 * tlen == sz(a) && !cnt; } if (2 * tlen > sz(a)) { return false; } if (a[i] != (tlen & 1)) { TRY(recover(a, i + 1, tlen + 1, cnt)); } if (cnt) { if (path.back().x != a[i]) { return false; } TRY(recover(a, i + 1, tlen, cnt - 1)); } else { int prv = 1; if (sz(path)) { prv = path.back().x; } path.push_back({a[i], a[i] != prv}); TRY(recover(a, i + 1, tlen, a[i] == prv ? 1 : 2)); path.pop_back(); } return false; } ll Bruno(vector<int> a) { path.clear(); recover(a, 1, 0, 0); ll n = 0; for (int i = 0; i < sz(path); ++i) { n |= path[i].y * (1ll << i); } return n; }
//bs:flags:grader.cpp #include "Anna.h" #include "Bruno.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; namespace x = __gnu_pbds; template <typename T> using ordered_set = x::tree<T, x::null_type, less<T>, x::rb_tree_tag, x::tree_order_statistics_node_update>; template <typename T> using normal_queue = priority_queue<T, vector<T>, greater<>>; #define all(x) begin(x), end(x) #define sz(x) ((int) (x).size()) #define x first #define y second using ll = long long; using ld = long double; int Declare() { return 181; } pair<vector<int>, vector<int>> Anna(ll n) { vector<int> u; for (; n; n /= 2) { u.push_back(n & 1); } vector<int> s = {1}; for (int i : u) { if (i) { s.push_back(s.back() ^ 1); } s.push_back(s.back()); s.push_back(s.back()); } vector<int> t = {1}; while (sz(t) != sz(s)) { t.push_back(t.back() ^ 1); } return {s, t}; } vector<pair<int, int>> path; #define TRY(x) do { if (x) { return true; }} while (false); bool recover(const vector<int> &a, int i, int tlen, int cnt) { if (i == sz(a)) { return 2 * tlen == sz(a) && !cnt; } if (2 * tlen > sz(a)) { return false; } if (a[i] != (tlen & 1)) { TRY(recover(a, i + 1, tlen + 1, cnt)); } if (cnt) { if (path.back().x != a[i]) { return false; } TRY(recover(a, i + 1, tlen, cnt - 1)); } else { int prv = 1; if (sz(path)) { prv = path.back().x; } path.push_back({a[i], a[i] != prv}); TRY(recover(a, i + 1, tlen, a[i] == prv ? 1 : 2)); path.pop_back(); } return false; } ll Bruno(vector<int> a) { path.clear(); recover(a, 1, 0, 0); ll n = 0; for (int i = 0; i < sz(path); ++i) { n |= path[i].y * (1ll << i); } return n; }
#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...