Submission #401752

#TimeUsernameProblemLanguageResultExecution timeMemory
401752peuchUnscrambling a Messy Bug (IOI16_messy)C++17
Compilation error
0 ms0 KiB
#include "messy.h" #include<bits/stdc++.h> using namespace std; std::vector<int> restore_permutation(int n, int w, int r) { srand(time(0)); vector<int> x (n); for(int i = 0; i < n; i++) x[i] = i; random_shuffle(x.begin(), x.end()); string aux(n, '0'); for(int i = 0; i < n; i++){ aux[x[i]] = '1'; // cout << "Adding: " << aux << "\n"; add_element(aux); } compile_set(); vector<int> marc(n, 0); vector<int> p(n, 0); aux = string(n, '0'); int last = n - 1; for(int i = 0; i < n - 1; i++){ int id = last; for(int j = 0; j < last; j++){ if(marc[x[j]]) continue; aux[x[j]] = '1'; // cout << "Checking: " << aux << "\n"; if(!check_element(aux)) { aux[x[j]] = '0'; continue; } id = j; break; } marc[x[id]] = 1; aux[x[id]] = '1'; p[x[id]] = x[i]; while(marx[last]) last--; // cout << aux << " " << check_element(aux) << "\n"; } p[x[last]] = x[n - 1]; return p; }

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:38:9: error: 'marx' was not declared in this scope; did you mean 'marc'?
   38 |   while(marx[last]) last--;
      |         ^~~~
      |         marc