# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1022540 | TroySer | Unscrambling a Messy Bug (IOI16_messy) | C++17 | 1 ms | 436 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;
vector<int> restore_permutation(int n, int w, int r) {
string toAdd[n-1];
for (int i = 1; i <= n-1; i++) {
string s = "";
for (int j = 0; j < i; j++) {
s += "1";
}
for (int j = i; j < n; j++) {
s += "0";
}
toAdd[i - 1] = s;
}
for (int i = 0; i < n-1; i++) {
add_element(toAdd[i]);
}
compile_set();
vector<int> perm(n, -1);
string currString, prevString = "";
for (int i = 0; i < n; i++) prevString.push_back('0');
for (int i = 0; i < n-1; i++) {
currString = prevString;
bool getOut = false;
for (int j = 0; j < n; j++) {
if (currString[j] == '0') {
currString[j] = '1';
if (check_element(currString)) {
perm[j] = i;
break;
}
currString[j] = '0';
}
}
prevString = currString;
}
for (int i = 0; i < n; i++) {
if (perm[i] == -1) {
perm[i] = n-1;
break;
}
}
return perm;
}
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... |