# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1202095 | ericl23302 | Unscrambling a Messy Bug (IOI16_messy) | C++20 | 0 ms | 328 KiB |
#include <vector>
#include <iostream>
#include <string>
#include "messy.h"
using namespace std;
std::vector<int> restore_permutation(int n, int w, int r) {
vector<int> mapTo(n, -1);
vector<bool> used(n, false);
string str = "";
for (int i = 0; i < n; ++i) str += "0";
for (int i = 0; i < n - 1; ++i) {
str[i] = '1';
add_element(str);
};
compile_set();
for (int i = 0; i < n; ++i) {
str = "";
for (int i = 0; i < n; ++i) str += "0";
for (int j = 0; j < i; ++j) str[mapTo[j]] = '1';
for (int j = 0; j < n; ++j) {
if (str[j] == '1') continue;
str[j] = '1';
if (check_element(str)) {
mapTo[i] = j;
used[j] = true;
break;
}
str[j] = '0';
}
}
for (int i = 0; i < n; ++i) {
if (!used[i]) {
mapTo[n - 1] = i;
break;
}
}
vector<int> res(n, -1);
for (int i = 0; i < n; ++i) res[mapTo[i]] = i;
return res;
}
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... |