Submission #414647

#TimeUsernameProblemLanguageResultExecution timeMemory
414647schseMechanical Doll (IOI18_doll)C++17
37 / 100
148 ms9000 KiB
#include "doll.h" #ifndef EVAL #include "grader.cpp" #endif #include <bits/stdc++.h> using namespace std; vector<int> C, X, Y; int mx = 2; vector<bool> tree((1 << 18) + 5, true); void rec(int index, int value) { if (index >= mx / 2) { if (tree[index]) X[index - 1] = value; else Y[index - 1] = value; } else if (tree[index]) rec(index * 2, value); else rec(index * 2 + 1, value); tree[index] = !tree[index]; } void create_circuit(int M, std::vector<int> A) { int N = A.size(); while (mx <= N) mx *= 2; X.resize(mx - 1); fill(X.begin(), X.end(), -1); Y = X; C.resize(M + 1); fill(C.begin(), C.end(), -1); for (int i = 1; i < mx / 2; i++) { X[i - 1] = i * -2; Y[i - 1] = i * -2 - 1; } for (int i : A) rec(1, i); Y[Y.size() - 1] = 0; 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...