# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1139527 | gyg | Unscrambling a Messy Bug (IOI16_messy) | C++20 | 1 ms | 328 KiB |
#include "messy.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define arr array
#define vec vector
#define str string
const int N = 40;
int n;
arr<int, N> ps;
vec<signed> restore_permutation(signed _n, signed _w, signed _r) {
n = _n;
for (int i = 1; i <= n; i++) {
str sq = "";
for (int j = 1; j <= n; j++) {
if (j <= i) sq += "1";
else sq += "0";
}
add_element(sq);
}
compile_set();
str sq = "";
for (int i = 1; i <= n; i++) sq += "0";
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
if (sq[j - 1] == '1') continue;
str nw_sq = sq;
nw_sq[j - 1] = '1';
if (!check_element(nw_sq)) continue;
ps[i] = j, sq = nw_sq;
break;
}
}
vec<signed> ans;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
if (ps[j] == i) ans.push_back(j - 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... |