# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1065622 | Hectorungo_18 | 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 <bits/stdc++.h>
#include "messy.h"
using namespace std;
mt19937 gnd(time(nullptr));
vector<int> restore_permutation(int n, int w, int r){
int mxb = 6;
string s (n, '0');
char u = '1', c = '0';
for(int bi = mxb; bi > 0 ; bi--){
if(bi == mxb){
for(int i = n/2; i < n; i++){
ch(s, i, u);
add_element(s);
ch(s, i, c);
}
}
else{
for(int i = 0; i < (1<<(bi+1)); i++){
ch(s, i, u);
}
for(int i = n/2+(1<<bi); i < n; i+=(1<<(bi+1))){
for(int j = i; j < i+(1<<(bi)); j++){
ch(s, j, u);
add_element(s);
ch(s, j, c);
}