Submission #1068987

#TimeUsernameProblemLanguageResultExecution timeMemory
1068987kilikumaPermutation (APIO22_perm)C++17
91.33 / 100
2 ms604 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; int cur; vector<int> ans; void construct(long long k) { if (k > 1) { if (k % 2 == 1) { construct(k - 1); ans.insert(ans.begin(), cur); cur ++; } else { construct(k / 2); ans.push_back(cur); cur ++; } } } vector<int> construct_permutation(long long k) { cur = 0; ans.clear(); construct(k); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...