Submission #197264

#TimeUsernameProblemLanguageResultExecution timeMemory
197264stefdascaMechanical Doll (IOI18_doll)C++14
Compilation error
0 ms0 KiB
#include "doll.h" #include<bits/stdc++.h> using namespace std; int adja[400002], adjb[400002], sw = 1, tot, state[400002]; void build(int p, int st, int dr) { int mid = (st + dr) / 2; if(st + 1 == dr) { if(tot <= mid) adja[p] = 1; return; } ++sw; adjb[p] = sw; solve(sw, st, mid); if(tot > mid) { ++sw; adja[p] = sw; solve(sw, m+1, r); } else adja[p] = 1; } void dfs(int nod, int val) { state[nod] ^= 1; if(!state[nod]) { if(adjb[nod]) dfs(adjb[nod], val); else adjb[nod] = val; } else { if(adja[nod]) dfs(adja[nod], val); else adja[nod] = val; } } void create_circuit(int M, vector<int> A) { int N = A.size(); vector<int> C(M + 1); C[0] = A[0]; A.push_back(0); int sz = 1; while(sz * 2 <= (int) A.size() - 1) sz *= 2; sz *= 2; tot = A.size(); build(1, 1, sz); for(int i = 0; i < A.size(); ++i) dfs(1, -A[i]); vector<int> X(sw), Y(sw); for(int k = 0; k < sw; ++k) { X[k] = -adja[k]; Y[k] = -adjb[k]; } answer(C, X, Y); }

Compilation message (stderr)

doll.cpp: In function 'void build(int, int, int)':
doll.cpp:19:5: error: 'solve' was not declared in this scope
   19 |     solve(sw, st, mid);
      |     ^~~~~
doll.cpp:24:19: error: 'm' was not declared in this scope
   24 |         solve(sw, m+1, r);
      |                   ^
doll.cpp:24:24: error: 'r' was not declared in this scope
   24 |         solve(sw, m+1, r);
      |                        ^
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:60:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |     for(int i = 0; i < A.size(); ++i)
      |                    ~~^~~~~~~~~~
doll.cpp:50:9: warning: unused variable 'N' [-Wunused-variable]
   50 |     int N = A.size();
      |         ^