# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1040725 | MarwenElarbi | Permutation (APIO22_perm) | C++17 | 1 ms | 348 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 <bits/stdc++.h>
#include "perm.h"
using namespace std;
#define pb push_back
std::vector<int> construct_permutation(long long k)
{
k--;
vector<int> tab;
int cnt=0;
for (int i = 63; i >= 0; --i)
{
if(k>=(1ll<<i)){
k-=(1ll<<i);
tab.pb(i+1);
cnt+=i+1;
}
}
vector<int> ans;
for (int i = 0; i < tab.size(); ++i)
{
for (int j = cnt-tab[i]; j < cnt; ++j)
{
ans.pb(j);
}
cnt-=tab[i];
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |