Submission #582684

#TimeUsernameProblemLanguageResultExecution timeMemory
582684VanillaPermutation (APIO22_perm)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<int> construct_permutation(ll k) { --k; int m = 1; while(k+1 > (1ll<<(m))) { ++m; } vector<int> perm(m); for (int i = 0; i < m; ++i) { perm[i] = i; } for (int i = m-2; i >= 0; --i) { if ((k & (1ll << i)) == 0) swap(perm[i],perm[i+1]); } return perm; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...