Submission #1065622

#TimeUsernameProblemLanguageResultExecution timeMemory
1065622Hectorungo_18Unscrambling a Messy Bug (IOI16_messy)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; mt19937 gnd(time(nullptr)); vector<int> restore_permutation(int n, int w, int r){ int mxb = 6; string s (n, '0'); char u = '1', c = '0'; for(int bi = mxb; bi > 0 ; bi--){ if(bi == mxb){ for(int i = n/2; i < n; i++){ ch(s, i, u); add_element(s); ch(s, i, c); } } else{ for(int i = 0; i < (1<<(bi+1)); i++){ ch(s, i, u); } for(int i = n/2+(1<<bi); i < n; i+=(1<<(bi+1))){ for(int j = i; j < i+(1<<(bi)); j++){ ch(s, j, u); add_element(s); ch(s, j, c); } } for(int i = 0; i < (1<<(bi+1)); i++){ ch(s, i, c); } for(int i = n/2; i < n/2+(1<<(bi+1)); i++){ ch(s, i, u); } for(int i = (1<<bi); i < n/2; i+=(1<<(bi+1))){ for(int j = i; j < i+(1<<(bi)); j++){ ch(s, j, u); add_element(s); ch(s, j, c); } } for(int i = n/2; i < n/2+(1<<(bi+1)); i++){ ch(s, i, c); } } } compile_set(); vector<int> ans(n, 0); set<int> fh, sh; vector<int> ffh, ssh; for(int bi = mxb; bi >= 0; bi--){ if(bi == mxb){ for(int i = 0; i < n; i++){ ch(s, i, u); int a = check_element(s); ch(s, i, c); if(a){ ans[i]+=(1<<bi); sh.insert(i); ssh.push_back(i); } else{ fh.insert(i); ffh.push_back(i); } } } else{ set<int> aux = sh; for(auto x : fh){ ch(s, x, u); } for(auto x : ssh){ ch(s, x, u); int a = check_element(s); ch(s, x, c); if(a){ if(sh.count(x)) sh.erase(x); ans[x]+=(1<<bi); } // else{ // } } for(auto x : fh){ ch(s, x, u); } for(auto x : aux){ ch(s, x, u); } for(auto x : ffh){ ch(s, x, u); int a = check_element(s); ch(s, x, c); if(a){ if(fh.count(x)) fh.erase(x); ans[x]+=(1<<bi); } } for(auto x : aux){ ch(s, x, c); } } } return ans; }

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:16:17: error: 'ch' was not declared in this scope; did you mean 'c'?
   16 |                 ch(s, i, u);
      |                 ^~
      |                 c
messy.cpp:23:17: error: 'ch' was not declared in this scope; did you mean 'c'?
   23 |                 ch(s, i, u);
      |                 ^~
      |                 c
messy.cpp:27:21: error: 'ch' was not declared in this scope; did you mean 'c'?
   27 |                     ch(s, j, u);
      |                     ^~
      |                     c
messy.cpp:33:17: error: 'ch' was not declared in this scope; did you mean 'c'?
   33 |                 ch(s, i, c);
      |                 ^~
      |                 c
messy.cpp:37:17: error: 'ch' was not declared in this scope; did you mean 'c'?
   37 |                 ch(s, i, u);
      |                 ^~
      |                 c
messy.cpp:41:21: error: 'ch' was not declared in this scope; did you mean 'c'?
   41 |                     ch(s, j, u);
      |                     ^~
      |                     c
messy.cpp:47:17: error: 'ch' was not declared in this scope; did you mean 'c'?
   47 |                 ch(s, i, c);
      |                 ^~
      |                 c
messy.cpp:60:17: error: 'ch' was not declared in this scope; did you mean 'sh'?
   60 |                 ch(s, i, u);
      |                 ^~
      |                 sh
messy.cpp:77:17: error: 'ch' was not declared in this scope; did you mean 'sh'?
   77 |                 ch(s, x, u);
      |                 ^~
      |                 sh
messy.cpp:80:17: error: 'ch' was not declared in this scope; did you mean 'sh'?
   80 |                 ch(s, x, u);
      |                 ^~
      |                 sh
messy.cpp:92:17: error: 'ch' was not declared in this scope; did you mean 'sh'?
   92 |                 ch(s, x, u);
      |                 ^~
      |                 sh
messy.cpp:97:17: error: 'ch' was not declared in this scope; did you mean 'sh'?
   97 |                 ch(s, x, u);
      |                 ^~
      |                 sh
messy.cpp:100:17: error: 'ch' was not declared in this scope; did you mean 'sh'?
  100 |                 ch(s, x, u);
      |                 ^~
      |                 sh
messy.cpp:110:17: error: 'ch' was not declared in this scope; did you mean 'sh'?
  110 |                 ch(s, x, c);
      |                 ^~
      |                 sh