Submission #1022572

#TimeUsernameProblemLanguageResultExecution timeMemory
1022572jamjanekUnscrambling a Messy Bug (IOI16_messy)C++14
Compilation error
0 ms0 KiB
//Rozwiazanie pelne k = m = n*log(n) #include <bits/stdc++.h> using namespace std; string pop[2]; int liczby[200]; void dodaj1(string s){ add_element(s); // cout<<"D:"<<s<<'\n'; } bool zapytaj1(string s){ bool czy = check_element(s); // cout<<"Z:"<<s<<':'<<czy<<"\n"; return czy; } vector<int> restore_permutation(int n, int m, int k){ int i, w, j; init(n,m,k); for(i=0;i<n;i++)pop[0]+='0'; for(i=0;i<n;i++)pop[1]+='0'; if(n==128)w=7; if(n==32)w=5; if(n==8)w=3; for(i=0;i<w;i++){ for(j=0;j<n;j++){ if((j>>i)&1){ auto &pom = pop[!((j>>(i-1))&1)]; pom[j] = '1'; dodaj1(pom); pom[j] = '0'; } } for(j=0;j<n;j++){ pop[0][j] = pop[1][j] = '0'; if((j>>i)&1)pop[1][j] = '1'; else pop[0][j] = '1'; } } let_him_cook(); for(i=0;i<w;i++){ for(j=0;j<n;j++){ string pom; bool czy = (liczby[j]>>(i-1))&1; for(int ij=0;ij<n;ij++)pom+='0'+((liczby[ij]>>(i-1))&1)^czy; pom[j]='1'; liczby[j]+=(1<<i)*zapytaj1(pom); } } vector<int>p; for(i=0;i<n;i++)p.push_back(liczby[i]); return(p); }

Compilation message (stderr)

messy.cpp: In function 'void dodaj1(std::string)':
messy.cpp:8:2: error: 'add_element' was not declared in this scope
    8 |  add_element(s);
      |  ^~~~~~~~~~~
messy.cpp: In function 'bool zapytaj1(std::string)':
messy.cpp:12:13: error: 'check_element' was not declared in this scope
   12 |  bool czy = check_element(s);
      |             ^~~~~~~~~~~~~
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:18:5: error: 'init' was not declared in this scope; did you mean 'int'?
   18 |     init(n,m,k);
      |     ^~~~
      |     int
messy.cpp:40:5: error: 'let_him_cook' was not declared in this scope
   40 |     let_him_cook();
      |     ^~~~~~~~~~~~
messy.cpp:46:35: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   46 |    for(int ij=0;ij<n;ij++)pom+='0'+((liczby[ij]>>(i-1))&1)^czy;
      |                                ~~~^~~~~~~~~~~~~~~~~~~~~~~~