Submission #767167

#TimeUsernameProblemLanguageResultExecution timeMemory
767167Ahmed57Permutation (APIO22_perm)C++17
91.33 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; vector<int> construct_permutation(long long k){ //0 1 2 3 4 5 6 7 8 k--; vector<int> v; for(long long i = 0;i<59;i++){ if((1LL<<i)<=k){ k-=(1LL<<i); v.push_back(i); } } for(long long i = 59;i>=0;i--){ while((1LL<<i)<=k){ long long xd = i; for(int j = v.size()-1;j>=xd;j--){ v[j]++; } v.push_back(i); k-=(1LL<<i); } } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...