| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1364824 | ahmetlbktd4 | Permutation (APIO22_perm) | C++20 | 0 ms | 0 KiB |
#include "permutation.h"
#include "bits/stdc++.h"
#define ll long long
using namespace std;
vector <int> construct_permutation(ll k){
int n = __lg(k);
vector <int> p(n);
iota(p.begin(),p.end(),0);
for (int i = n-1;i >= 0;i--){
if (n>>i&1){
p.insert(p.begin()+i,n);
n++;
}
}
return p;
}
// int main(){
// ll k;
// cin >> k;
// vector <int> p = construct_permutation(k);
// for (auto x : p){
// cout << x << " ";
// }
// }