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 "messy.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> restore_permutation(int n, int w, int r) {
for (int i=0 ; i<n-1 ; i++) {
string element = "";
for (int j=0 ; j<n ; j++) {
element += j <= i ? '1' : '0';
}
add_element(element);
}
compile_set();
vector<int> p(n, -1);
vector<bool> is_one(n, false);
for (int i=0 ; i<n-1 ; i++) {
for (int j=0 ; j<n ; j++) {
if (is_one[j]) {
continue;
}
string element = "";
for (int k=0 ; k<n ; k++) {
element += is_one[k] || k == j ? '1' : '0';
}
if (check_element(element)) {
is_one[j] = true;
p[j] = i;
break;
}
}
}
for (int i=0 ; i<n ; i++) {
if (p[i] == -1) {
p[i] = n - 1;
}
}
return p;
}
# | 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... |