Submission #621469

#TimeUsernameProblemLanguageResultExecution timeMemory
621469gromperenPermutation (APIO22_perm)C++17
91.33 / 100
2 ms340 KiB
#include "perm.h" #include <bits/stdc++.h> #define ll long long using namespace std; vector<int> construct_permutation(ll k) { vector<int> ans; int x = __lg(k); for (int i = 0; i < x; ++i) ans.push_back(i); for (int i = x - 1; i >= 0; --i) { if ((k>>i)&1) { ans.insert(ans.begin()+i, x); x++; } } return ans; } /* vector<int> construct_permutation(ll k) { k--; vector<int> ans; int mx = 0; while (k > 0) { int i = 60; while ((1LL << i) - 1 > k) { i--; } for (int j = mx+i-1; j >= mx; --j) { ans.push_back(j); } mx = mx+i; k-= (1LL << i) - 1; } reverse(ans.begin(), ans.end()); cout << endl; return ans; } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...