# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
392153 | AugustinasJucas | 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.
using namespace std;
#include <bits/stdc++.h>
vector<int> restore_permutation(int n, int w, int r) {
string db = "";
for(int i = 0; i < n; i++) db += '0';
for(int i = 0; i < n; i++){
db[i] = '1';
// cout << "idedu " << db << endl;
add_element(db);
}
compile_set();
string kolKas(n, '0');
vector<int> ret(n);
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
if(kolKas[j] == '1') continue;
auto cp = kolKas;
cp[j] = '1';
bool yra = check_element(cp);
if(yra){
// tada i-asis bitas mapinasi i j
ret[j] = i;
kolKas = cp;
break;
}
}
}
// cout << "ret = ["; for(auto x : ret) cout << x << " "; cout << "]\n";
return ret;
}