Submission #601763

#TimeUsernameProblemLanguageResultExecution timeMemory
601763enerelt14Mechanical Doll (IOI18_doll)C++14
Compilation error
0 ms0 KiB
#include "doll.h" #include<bits/stdc++.h> #define pb push_back using namespace std; int x[40], y[40]; vector<int>a; bool is[40]; int tree[100], q; void go(int id, int l, int r){ if(l==r){ if (q==16)tree[id]=-(k+q); else tree[id]=a[q]; return; } else tree[id]=-(k+id); int mid=(l+r)/2; if (!is[id]){ go(id*2, l, mid); x[id+k]=tree[id*2]; is[id]=1; } else{ go(id*2+1, mid+1, r); y[id+k]=tree[id*2+1]; is[id]=0; } } void create_circuit(int M, vector<int>A){ a=A; vector<int>c, X, Y; c.pb(a[0]); for (int i=1;i<=M;i++)c.pb(-1); for (int i=1;i<=16;i++){ q=i; go(1, 1, 16); } x[16]=-16; y[16]=0; for (int i=1;i<=16;i++)X.pb(x[i]); for (int i=1;i<=16;i++)Y.pb(y[i]); answer(c, X, Y); }

Compilation message (stderr)

doll.cpp: In function 'void go(int, int, int)':
doll.cpp:11:26: error: 'k' was not declared in this scope
   11 |     if (q==16)tree[id]=-(k+q);
      |                          ^
doll.cpp:15:19: error: 'k' was not declared in this scope
   15 |   else tree[id]=-(k+id);
      |                   ^
doll.cpp:19:10: error: 'k' was not declared in this scope
   19 |     x[id+k]=tree[id*2];
      |          ^
doll.cpp:24:10: error: 'k' was not declared in this scope
   24 |     y[id+k]=tree[id*2+1];
      |          ^