Submission #975989

#TimeUsernameProblemLanguageResultExecution timeMemory
975989OrifkhonPermutation (APIO22_perm)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include <perm.h> using namespace std; vector<int> construct_permutation(long long k) { long long size = log2(k); vector<int> perm(size); for(int i = 0; i < size; i++){ perm[i] = i; } k-=(1 << size); long long insert = size; while(true){ if(k == 0){ break; } long long ind = log2(k); k-=(1 << ind); if(ind == 0){ perm.insert(perm.begin(), insert); insert++; continue; } perm.insert(perm.begin() + ind - 1, insert); insert++; } return perm; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...