# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1160526 | Aviansh | Permutation (APIO22_perm) | C++20 | 7 ms | 1352 KiB |
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> construct_permutation(long long k)
{
vector<int>ans;
vector<int>pows;
int sum = 0;
while(k>1){
for(int i = 63;i>=0;i--){
if(k&(1LL<<i)){
pows.push_back(i);
sum+=i;
k^=(1LL<<i);
break;
}
}
k++;
}
for(int i : pows){
sum-=i;
for(int j = 0;j<i;j++){
ans.push_back(sum+j);
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |