# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
768049 | 1ne | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 0 ms | 0 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 <vector>
#include "messy.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> restore_permutation(int n, int w, int r) {
string s;
for (int i = 0;i<n;++i){
s+='0';
}
for (int i = 0;i<n - 1;++i){
s[i] = '1';
add_element(s);
}
compile_set();
vector<int>pos(n,-1);
string cur;
for (int i = 0;i<n;++i){
cur+='0';
}
for (int i = 0;i<n - 1;++i){
for (int j = 0;j<n;++j){
if (cur[j] == '1')continue;
cur[j] = '1';
if (check_element(cur)){
pos[i] = j + 1;
break;
}
cur[j] = '0';
}
}
for (int i = 0;i<n;++i){
if (cur[j] == '0'){
pos[n - 1] = i + 1;
}
}
return pos;
}