# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
911301 | hjroh0315 | Permutation (APIO22_perm) | C++17 | 2 ms | 356 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include"perm.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<int>construct_permutation(long long k)
{
vector<int>ans;
auto f=k;int last=-1;
for(int i=0;i<62;i++)
{
if(f>0)
{
if(f&1)f--;
if(f>0)ans.push_back(i);
last=i;
f>>=1;
}
}
last--;
while(last>=0)
{
if(k>>last&1)
{
for(int i=0;i<size(ans);i++)
{
if(ans[i]>=last)ans[i]++;
}
ans.push_back(last);
}
last--;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |