# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1247568 | julia_08 | Unscrambling a Messy Bug (IOI16_messy) | C++20 | 1 ms | 328 KiB |
#include <bits/stdc++.h>
#include "messy.h"
using namespace std;
int n;
string str(int x){
string s;
for(int i=0; i<n; i++){
if(x & (1 << i)){
s.push_back('1');
} else s.push_back('0');
}
return s;
}
vector<int> restore_permutation(int n_, int w, int r){
n = n_;
for(int i=0; i<n; i++) add_element(str((1 << (i + 1)) - 1));
compile_set();
vector<int> ans;
for(int i=0; i<n; i++) ans.push_back(i);
for(int i=0; i<n; i++){
if(check_element(str((1 << (i + 1)) - 1))) continue;
for(int j=(i + 1); j<n; j++){
if(check_element(str((1 << i) - 1 + (1 << j)))){
swap(ans[i], ans[j]);
return ans;
}
}
}
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... |