# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
976262 | Unforgettablepl | Permutation (APIO22_perm) | C++17 | 3 ms | 600 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
std::vector<int32_t> construct_permutation(long long k){
vector<int32_t> ans;
if(k&1){
ans.emplace_back(-1);
k--;
}
for(int bit=1;bit<=64 and k;bit++) {
ans.emplace_back(bit-1);
if (k & (1ll << bit)){
ans.emplace_back(-1);
k -= (1ll << bit);
}
}
ans.erase(--ans.end());
int curr = ans.back();
reverse(ans.begin(), ans.end());
for(int32_t &i:ans)if(i==-1)i=++curr;
reverse(ans.begin(), ans.end());
return ans;
}
//static long long MX=1e18;
//
//static bool check_permutation(vector<int32_t> v)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |