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;
string S;
void f(int l, int r) {
if (l + 1 == r) {
return;
}
int m = (l + r) / 2;
for (int i = l; i < m; i++) {
S[i] = '1';
add_element(S);
S[i] = '0';
}
fill(S.begin() + m, S.begin() + r, '1');
f(l, m);
fill(S.begin() + m, S.begin() + r, '0');
fill(S.begin() + l, S.begin() + m, '1');
f(m, r);
fill(S.begin() + l, S.begin() + m, '0');
}
vector<int> restore_permutation(int N, int W, int R) {
S = string(N, '0');
f(0, N);
compile_set();
vector<int> P(N);
for (int i = __lg(N) - 1; i >= 0; i--) {
auto a = P;
for (int j = 0; j < N; j++) {
string S(N, '0');
for (int k = 0; k < N; k++) {
if (a[j] != a[k] || j == k) {
S[k] = '1';
}
}
if (!check_element(S)) {
P[j] += 1 << i;
}
}
}
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... |