Submission #767162

#TimeUsernameProblemLanguageResultExecution timeMemory
767162Ahmed57Permutation (APIO22_perm)C++17
91.33 / 100
2 ms340 KiB
#include <bits/stdc++.h> using namespace std; vector<int> construct_permutation(long long k){ k--; vector<int> v; for(long long i = 0;i<60;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...