Submission #414622

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

Compilation message (stderr)

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:31:7: warning: unused variable 'N' [-Wunused-variable]
   31 |   int N = A.size();
      |       ^
#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...