Submission #838544

#TimeUsernameProblemLanguageResultExecution timeMemory
838544finn__Permutation (APIO22_perm)C++17
100 / 100
2 ms340 KiB
#include <bits/stdc++.h> #include "perm.h" using namespace std; vector<int> construct_permutation(long long k) { if (k == 1) return {}; if (k == 2) return {0}; for (int q : {2, 3, 5, 7, 11, 13, 17, 19, 23}) if (!(k % q) && k > q) { auto p = construct_permutation(k / q); auto s = construct_permutation(q); for (int &x : s) x += p.size(); p.insert(p.end(), s.begin(), s.end()); return p; } auto p = construct_permutation(k >> 1); p.push_back(p.size()); p.insert(p.begin(), p.size()); return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...