# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1037306 | RaresFelix | Unscrambling a Messy Bug (IOI16_messy) | C++17 | 1 ms | 856 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;
using vi = vector<int>;
vi restore_permutation(int n, int w, int r) {
vector<vi> S;
vi V0;
for(int i = 0; i < n; ++i) V0.push_back(i);
S = {V0};
while(S.size() != n) {
vector<vi> Snou;
for(auto &V : S) {
int len = V.size();
vi V1, V2;
for(int i = 0; i < len / 2; ++i) V1.push_back(V[i]);
for(int i = 0; i < len / 2; ++i) V2.push_back(V[i + len / 2]);
Snou.push_back(V1);
Snou.push_back(V2);
string s;
for(int i = 0; i < n; ++i) s += '0';
for(auto it : V) s[it] = '1';
for(auto it : V1) {
s[it] = '0';
add_element(s);
s[it] = '1';
}
}
S = Snou;
}
compile_set();
S = {V0};
while(S.size() != n) {
vector<vi> Snou;
for(auto &V : S) {
int len = V.size();
string s;
for(int i = 0; i < n; ++i) s += '0';
for(auto it : V) s[it] = '1';
vi V1, V2;
for(auto it : V) {
s[it] = '0';
auto re = check_element(s);
if(re) V1.push_back(it);
else V2.push_back(it);
s[it] = '1';
}
Snou.push_back(V1);
Snou.push_back(V2);
}
S = Snou;
}
vi Re(n, 0);
for(int i = 0; i < n; ++i)
Re[S[i][0]] = i;
return Re;
}
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... |