Submission #413420

#TimeUsernameProblemLanguageResultExecution timeMemory
413420schseMechanical Doll (IOI18_doll)C++17
Compilation error
0 ms0 KiB
#include "doll.h" #ifndef EVAL #include "grader.cpp" #endif #include <bits/stdc++.h> using namespace std; vector<int> C(17), X(15), Y(15); vector<bool> tree(16); void rec(int index, int value) { if (index > 7) { 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) { fill(tree.begin(), tree.end(), true); for (int i = 1; i < 8; i++) { X[i - 1] = i * -2; Y[i - 1] = i * -2 - 1; } for (int i = 1; i < N; i++) { rec(1, A[i]); } rec(1, 0); fill(C.begin(), C.end(), -1); C[0] = A[0]; answer(C, X, Y); }

Compilation message (stderr)

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:38:23: error: 'N' was not declared in this scope
   38 |   for (int i = 1; i < N; i++)
      |                       ^