This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "messy.h"
using namespace std;
vector<int> restore_permutation(int n, int w, int r) {
    string mask = string(32, '0');
    for(int i=0; i<32; ++i) {
        mask[i] = '1';
        add_element(mask);
    }
    compile_set();
    vector<int>p(n);
    set<int>already;
    for(int i=0; i<32; ++i) {
        mask = string(32, '0');
        for(int x : already) {
            mask[x] = '1';
        }
        int new_pos = -1;
        for(int j=0; j<32; ++j) if(mask[j]=='0') {
            mask[j] = '1';
            if(check_element(mask)) {
                new_pos = j;
                break;
            }
            mask[j] = '0';
        }
        p[i] = new_pos;
        already.insert(new_pos);
    }
    return p;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |