Submission #118307

#TimeUsernameProblemLanguageResultExecution timeMemory
118307SortingMechanical Doll (IOI18_doll)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; void answer(vector<int> C, vector<int> X, vector<int> Y); vector<int> C, X, Y; const int N = 1e6 + 7; int B[N][2], timer[N], cnt, n, m, k = 0; int f(int s, int e){ if(n <= s){ return 1; } if(s == e){ return -1; } int m = (s + e) / 2, c = ++k; B[c][1] = f(s, m); B[c][0] = f(m + 1, e); return c; } void create_circuit(int M, vector<int> A){ for(int i = 0; i < M; i++){ C.push_back(-1); } C.push_back(-1); A.push_back(0); n = (int)A.size(); m = M; int t = 1; while(t < n){ t *= 2; } f(0, t - 1); for(int i = 1, c = 0; c < n;){ int &x = B[i][timer[i] & 1]; ++timer[i]; if(x < 0){ x = -A[c++]; i = 1; continue; } i = j; } for(int i = 1; i <= k; i++){ X.push_back(-B[i][0]); Y.push_back(-B[i][1]); } answer(C, X, Y); }

Compilation message (stderr)

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:57:7: error: 'j' was not declared in this scope
   57 |   i = j;
      |       ^