Submission #1273376

#TimeUsernameProblemLanguageResultExecution timeMemory
1273376BlockOGMechanical Doll (IOI18_doll)C++20
0 / 100
160 ms327680 KiB
#include <bits/stdc++.h> // mrrrow meeow :3 // go play vivid/stasis now! https://vividstasis.gay #define fo(i, a, b) for (auto i = (a); i < (b); i++) #define of(i, a, b) for (auto i = (b); i-- > (a);) #define f first #define s second #define pb push_back #define pob pop_back #define lb lower_bound #define ub upper_bound #define be(a) a.begin(), a.end() using namespace std; int ____init = [] { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); return 0; }(); void answer(vector<int> c, vector<int> x, vector<int> y); int s = -1; vector<int> x, y; int get_node(vector<int> order) { if (order.size() == 1) return order[0]; int res = s; if (order.size() & 1) order.insert(order.begin(), s); else { fo(i, 0, order.size() / 2) { if (order[i] != order[order.size() / 2 + i]) goto nope; } order.resize(order.size() / 2); return get_node(order); nope:; } s--; int to_overwrite = x.size(); x.pb(0), y.pb(0); vector<int> left, right; fo(i, 0, order.size()) { if (i & 1) right.pb(order[i]); else left.pb(order[i]); } x[to_overwrite] = get_node(left); y[to_overwrite] = get_node(right); return res; } void create_circuit(int m, vector<int> a) { int n = a.size(); a.pb(0); map<int, int> amap; fo(i, 0, n) { if (amap.count(a[i]) && amap[a[i]] != a[i + 1]) amap[a[i]] = -1; else amap[a[i]] = a[i + 1]; } vector<int> t; fo(i, 0, n) { if (amap[a[i]] == -1) t.pb(a[i + 1]); } get_node(t); vector<int> c(m + 1); c[0] = a[0]; fo(i, 0, m) c[i + 1] = amap[i + 1]; answer(c, x, y); }
#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...