# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1121933 | ElayV13 | Unscrambling a Messy Bug (IOI16_messy) | C++17 | 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 "messy.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> restore_permutation(int n, int w, int r) {
vector < string > s;
for(int i = 0;i < n - 1;i++)
{
string q = "";
for(int j = 0;j <= i;j++) q = q + '0';
for(int j = i + 1;j < n;j++) q = q + '1';
s.push_back(q);
add_element(q);
}
compile_set();
for(int i = 0;i < n;i++) for(int j = i;j < n;j++){
bool f = 1;
for(int p = 0;p < n - 1;p++){
string q = s[p];
swap(q[i] , q[j]);
f &= check_element(q);
}
if(ok){
vector < int > ans(n);
for(int p = 0;p < n;p++) ans[p] = p;
swap(ans[i] , ans[j]);
return ans;
}
}
}