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"
#include <vector>
using namespace std;
vector<int> restore_permutation(int n,int w,int r) {vector<int>p(n);auto o=[&](int l, int r, auto &&o) {if (l >= r) return;int m = (l + r) / 2;string s(n, '0');for (int i = l; i <= r; i++){s[i] = '1';}for (int i = l; i <= m; i++){s[i] = '0';add_element(s);s[i] = '1';}o(l, m, o);o(m + 1, r, o);};o(0, n - 1, o);compile_set();auto x = [&] (int l, int r, vector <int> ps, auto &&x) {if (ps.size() == 1) return;int m = (l + r) / 2;string s(n, '0');vector <int> a,b;for (int i: ps) s[i] = '1';for (int i: ps) {s[i] = '0';if(check_element(s))a.push_back(i);else b.push_back(i),p[i]+=ps.size()/2;s[i]='1';}x(l,m,a,x);x(m+1,r,b,x);};vector<int>v;for(int i=0;i<n;i++)v.push_back(i);x(0,n-1,v,x);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... |