Submission #958390

#TimeUsernameProblemLanguageResultExecution timeMemory
958390AkibAzmainMechanical Doll (IOI18_doll)C++17
6 / 100
52 ms12352 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; using ll = long long; void create_circuit(int m, std::vector<int> a) { int p = 0; a.push_back (0); vector < vector < int > > adj (m + 1); for (auto &x : a) adj[p].push_back (x), p = x; vector < int > c (m + 1), x, y; x.reserve (a.size () * 2); y.reserve (a.size () * 2); for (int i = 0; i <= m; ++i) { if (adj[i].empty ()) continue; auto f = [&] (auto &self, int &p, int l, int r) -> void { if (l + 1 == r) p = adj[i][l]; else { int m = (l + r) / 2; x.push_back (0), y.push_back (0); p = -x.size (); self (self, x.back (), l, m); self (self, y.back (), m, r); } }; f (f, c[i], 0, adj[i].size ()); } 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...