Submission #907553

#TimeUsernameProblemLanguageResultExecution timeMemory
907553vjudge1Permutation (APIO22_perm)C++17
91.33 / 100
2 ms600 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; std::vector<int> construct_permutation(long long k) { // cout << "Solving for " << k << endl; if (k <= 2) { vector<int> perm(k-1); iota(perm.begin(), perm.end(), 0ll); reverse(perm.begin(), perm.end()); return perm; } if (k%2 == 1) { vector<int> res = construct_permutation(k-1); res.insert(res.begin(), res.size()); return res; } else { vector<int> res = construct_permutation(k/2); for (auto &x: res) x+=1; res.insert(res.begin(), 0); return res; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...