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 "perm.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using i64 = long long;
#define ln "\n"
#define all(x) (x).begin(), (x).end()
#define rep(i,a,b) for(int i=a; i<=b; ++i)
const int mxN = 1e6 + 5;
int n;
vector<int> construct_permutation(long long x) {
vector<int> ans;
vector<int> s;
int l = 0, r = 0;
while (x > 1) {
if (x & 1) {
ans.push_back(--l);
s.push_back(l);
--x;
}
else {
ans.push_back(++r);
s.push_back(r);
x >>= 1;
}
}
sort(all(s));
s.erase(unique(all(s)), s.end());
for (int& i : ans)
i = lower_bound(all(s), i) - s.begin();
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |