Submission #412021

#TimeUsernameProblemLanguageResultExecution timeMemory
412021MlxaMechanical Doll (IOI18_doll)C++14
37 / 100
184 ms14200 KiB
#include <bits/stdc++.h> using namespace std; #include "doll.h" #define all(x) x.begin(), x.end() #define mp make_pair #define mt make_tuple #define x first #define y second const int MAX = 1e9; vector<int> x, y, arr; int solve(vector<int> idx) { assert(idx.size()); if (idx.size() == 1) { if (idx[0] >= MAX / 2) { return idx[0] - MAX; } return idx[0] == (int)arr.size() ? 0 : arr[idx[0]]; } x.push_back(0), y.push_back(0); int v = -(int)x.size(); vector<int> lef, rig; if (idx.size() % 2) { idx.insert(idx.begin(), MAX + v); } for (int i = 0; i < (int)idx.size(); ++i) { (i % 2 ? rig : lef).push_back(idx[i]); } assert(0 <= -1 - v && -1 - v < (int)x.size()); assert(0 <= -1 - v && -1 - v < (int)y.size()); int a = solve(lef), b = solve(rig); x[-1 - v] = a; y[-1 - v] = b; return v; } void create_circuit(int m, vector<int> a) { arr = a; vector<int> c(m + 1, -1), idx((int)a.size() + 1); iota(all(idx), 0); int root = solve(idx); assert(root == -1); // cout << "===" << endl; // for (int e : c) { // cout << e << " "; // } // cout << endl; // for (int e : x) { // cout << e << " "; // } // cout << endl; // for (int e : y) { // cout << e << " "; // } // cout << endl; answer(c, x, y); } #ifdef LC #include "grader.cpp" #endif
#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...