Submission #623462

#TimeUsernameProblemLanguageResultExecution timeMemory
623462M_WUnscrambling a Messy Bug (IOI16_messy)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; bool pos[128][128]; // original ==> permuted int N; void process(string ask, int l, int r){ if(l == r) return; int mid = (l + r) >> 1; for(int i = l; i <= mid; i++){ ask[i] = '1'; add_element(ask); ask[i] = '0'; } for(int i = l; i <= mid; i++) ask[i] = '1'; process(ask, mid + 1, r); for(int i = l; i <= mid; i++) ask[i] = '0'; for(int i = mid + 1; i <= r; i++) ask[i] = '1'; process(ask, l, mid); } void solve(string ask, int l, int r, vector<int> v){ if(l == r) return; vector<int> ll, rr; int mid = (l + r) >> 1; for(auto x : v){ ask[x] = '1'; bool res = check_element(ask); ask[x] = '0'; for(int i = l; i <= mid; i++) pos[i][x] = res; for(int i = mid + 1; i <= r; i++) pos[i][x] = !res; if(res) ll.push_back(x); else rr.push_back(x); } for(auto x : ll) ask[x] = '1'; solve(ask, mid + 1, r, rr); for(auto x : ll) ask[x] = '0'; for(auto x : rr) ask[x] = '1'; solve(ask, l, mid, ll); } vector<int> restore_permutation(int _N, int W, int R){ N = _N; string ask; for(int i = 0; i < N; i++) ask += "0"; process(ask, 0, N - 1); compile_set(); vector<int> v; for(int i = 0; i < N; i++) v.push_back(i); solve(ask, 0, N - 1, v); vector<int> res(N); for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++){ if(pos[j][i]) res[i] = j; } } return res; }

Compilation message (stderr)

messy.cpp: In function 'void process(std::string, int, int)':
messy.cpp:12:9: error: 'add_element' was not declared in this scope
   12 |         add_element(ask);
      |         ^~~~~~~~~~~
messy.cpp: In function 'void solve(std::string, int, int, std::vector<int>)':
messy.cpp:29:20: error: 'check_element' was not declared in this scope
   29 |         bool res = check_element(ask);
      |                    ^~~~~~~~~~~~~
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:51:5: error: 'compile_set' was not declared in this scope
   51 |     compile_set();
      |     ^~~~~~~~~~~