Submission #1065635

#TimeUsernameProblemLanguageResultExecution timeMemory
1065635Hectorungo_18Aliens (IOI16_aliens)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> // #include "messy.h" using namespace std; mt19937 gnd(time(nullptr)); // #define int long long void ch(string& s, int pos, char c){ s[pos]=c; return; } vector<int> restore_permutation(int n, int w, int r){ int mxb = 6; int bb = 0; int aux = n; while(aux > 1){ bb++; aux/=2; } mxb = bb-1; cout << mxb << endl; 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, c); } 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)

aliens.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
aliens.cpp:31:17: error: 'add_element' was not declared in this scope
   31 |                 add_element(s);
      |                 ^~~~~~~~~~~
aliens.cpp:42:21: error: 'add_element' was not declared in this scope
   42 |                     add_element(s);
      |                     ^~~~~~~~~~~
aliens.cpp:56:21: error: 'add_element' was not declared in this scope
   56 |                     add_element(s);
      |                     ^~~~~~~~~~~
aliens.cpp:66:5: error: 'compile_set' was not declared in this scope
   66 |     compile_set();
      |     ^~~~~~~~~~~
aliens.cpp:75:25: error: 'check_element' was not declared in this scope
   75 |                 int a = check_element(s);
      |                         ^~~~~~~~~~~~~
aliens.cpp:95:25: error: 'check_element' was not declared in this scope
   95 |                 int a = check_element(s);
      |                         ^~~~~~~~~~~~~
aliens.cpp:115:25: error: 'check_element' was not declared in this scope
  115 |                 int a = check_element(s);
      |                         ^~~~~~~~~~~~~