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 <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <vector>
using namespace std;
vector<int> restore_permutation(int n, int w, int r) {
int x = __lg(n);
for(int i = 0; i < x; i++) {
string S(n, '0');
for(int j = 0; j <= i; j++) {
S[j] = '1';
}
add_element(S);
}
for(int i = 0; i < x; i++) {
string S(n, '1');
S[i] = '0';
for(int j = x; j < n; j++) {
if(j & (1 << i)) continue;
S[j] = '0';
add_element(S);
S[j] = '1';
}
}
compile_set();
vector<int> ans(n, -1), p(n, -1);
for(int i = 0; i < x; i++) {
string S(n, '0');
for(int j = 0; j < n; j++) {
if(ans[j] == -1) continue;
S[j] = '1';
}
for(int j = 0; j < n; j++) {
if(ans[j] != -1) continue;
S[j] = '1';
if(!check_element(S)) {
S[j] = '0';
continue;
}
ans[j] = i;
p[i] = j;
break;
}
}
for(int i = 0; i < n; i++) {
if(ans[i] != -1) continue;
ans[i] = 0;
string S(n, '1');
S[i] = '0';
for(int j = 0; j < x; j++) {
S[p[j]] = '0';
if(!check_element(S)) {
ans[i] += (1 << j);
}
S[p[j]] = '1';
}
}
return ans;
}
# | 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... |