# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1213691 | toast12 | Unscrambling a Messy Bug (IOI16_messy) | C++20 | 0 ms | 328 KiB |
#include <bits/stdc++.h>
#include "messy.h"
using namespace std;
std::vector<int> restore_permutation(int n, int w, int r) {
string s = "";
for (int i = 0; i < n; i++) s += '0';
for (int i = n-1; i >= 0; i--) {
s[i] = '1';
add_element(s);
}
compile_set();
vector<int> ans(n, -1);
vector<bool> done(n);
for (int i = n-1; i >= 0; i--) s[i] = '0';
for (int idx = n-1; idx >= 0; idx--) {
vector<int> temp;
for (int i = n-1; i >= 0; i--) {
if (s[i] == '0') temp.push_back(i);
}
shuffle(temp.begin(), temp.end(), default_random_engine(0));
int i = 0;
while (true) {
s[temp[i]] = '1';
bool ret = check_element(s);
if (ret) {
ans[temp[i]] = idx;
break;
}
s[temp[i]] = '0';
i++;
s[temp[i]] = '1';
}
}
return ans;
}
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... |