이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "messy.h"
using namespace std;
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int nax = 32;
vector<int> restore_permutation(int n, int w, int r) {
    string mask = string(nax, '0');
    for(int i=0; i<nax; ++i) {
        mask[i] = '1';
        add_element(mask);
    }
    compile_set();
    vector<int>p(n);
    set<int>already;
    for(int i=0; i<nax; ++i) {
        mask = string(nax, '0');
        for(int x : already) {
            mask[x] = '1';
        }
        int new_pos = -1;
        vector<int>off;
        for(int j=0; j<nax; ++j) if(mask[j]=='0') {
            off.push_back(j);
        }
        random_shuffle(off.begin(), off.end());
        for(int j : off) {
            mask[j] = '1';
            if(check_element(mask)) {
                new_pos = j;
                break;
            }
            mask[j] = '0';
        }
        p[new_pos] = i;
        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... |