# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
952546 | SmuggingSpun | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 1 ms | 760 KiB |
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 "messy.h"
#include<bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
vector<int>restore_permutation(int n, int w, int r){
assert(n <= 32);
if(n <= 32){
string s(n, '0'), current(n, '0');
for(int i = 0; i + 1 < n; i++){
s[i] = '1';
add_element(s);
}
compile_set();
vector<int>ans(n), p(n);
iota(p.begin(), p.end(), 0);
for(int i = 0; i < n; i++){
shuffle(p.begin(), p.end(), rng);
int index = int(p.size()) - 1;
for(int i = 0; i + 1 < p.size(); i++){
current[p[i]] = '1';
if(check_element(current)){
index = i;
break;
}
current[p[i]] = '0';
}
current[p[index]] = '1';
ans[p[index]] = i;
p.erase(p.begin() + index);
}
return ans;
}
}
Compilation message (stderr)
# | 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... |