# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
731433 | ogibogi2004 | Permutation (APIO22_perm) | C++17 | 13 ms | 1332 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>
#define ll long long
using namespace std;
vector<int> construct_permutation(long long k)
{
vector<int>ret;
int sz=0;
k--;
while(k)
{
ll p=0;
while((1ll<<p)-1<=k)
{
p++;
}
p--;
ret.push_back(p);
k-=(1ll<<p)-1;
}
for(int i=0;i<ret.size();i++)sz+=ret[i];
vector<int>ans;
for(int i=0;i<ret.size();i++)
{
for(int j=1;j<=ret[i];j++)
{
ans.push_back(sz-ret[i]+j);
}
sz-=ret[i];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |