Submission #756201

#TimeUsernameProblemLanguageResultExecution timeMemory
756201alexander707070Unscrambling a Messy Bug (IOI16_messy)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#define MAXN 10007
using namespace std;

int n;
string curr,zero;
int p[MAXN];
bool used[MAXN];
vector<int> ans;

vector<int> restore_permutation(int N, int w, int r){
    n=N;
    for(int i=1;i<=n;i++)zero.push_back('0');

    for(int i=1;i<=n;i++){
        curr="";
        for(int f=0;f<i;f++)curr.push_back('1');
        for(int f=0;f<n-i;f++)curr.push_back('0');
        add_element(curr);
    }

    compile_set();

    for(int i=0;i<n;i++){
        curr=zero;
        for(int f=0;f<=i;f++){
            curr[p[f]]='1';
        }
        for(int f=0;f<n;f++){
            if(!used[p[f]]){
                curr[f]='1';
                if(check_element(curr)){
                    p[i]=f; used[f]=true; break;
                }
                curr[f]='0';
            }
        }
    }

    for(int i=0;i<n;i++){
        ans.push_back(p[i]);
    }

    return ans;
}

/*
int main(){

}
*/

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:19:9: error: 'add_element' was not declared in this scope
   19 |         add_element(curr);
      |         ^~~~~~~~~~~
messy.cpp:22:5: error: 'compile_set' was not declared in this scope
   22 |     compile_set();
      |     ^~~~~~~~~~~
messy.cpp:32:20: error: 'check_element' was not declared in this scope
   32 |                 if(check_element(curr)){
      |                    ^~~~~~~~~~~~~