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"
#ifdef NYAOWO
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define eb emplace_back
#define int LL
using namespace std;
using LL = long long;
using pii = pair<int, int>;
std::vector<int32_t> construct_permutation(long long k) {
vector<int32_t> a, b;
int cur = 0, p = 0;
while(k > (1ll << p)) {
if(k & (1ll << p)) {
b.eb(cur); cur++;
k -= (1ll << p);
}
p++;
if(k) {
a.eb(cur); cur++;
}
}
reverse(all(b));
a.insert(a.end(), all(b));
for(auto &i:a) cerr << i << " ";
cerr << "\n";
return a;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |