Submission #976001

#TimeUsernameProblemLanguageResultExecution timeMemory
976001OrifkhonPermutation (APIO22_perm)C++17
10 / 100
1 ms348 KiB
#include<bits/stdc++.h> #include "perm.h" using namespace std; #ifdef LOCAL #include "debug.cpp" #else #define debug(...) #endif vector<int> construct_permutation(long long k) { int size = log2(k); vector<int> perm(size); for(int i = 0; i < size; i++){ perm[i] = i; } k-=(1ll << size); int insert = size; while(k > 0){ int ind = log2(k); k-=(1ll << ind); perm.insert(perm.begin() + ind, insert); insert++; } debug(perm); return perm; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...