# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1040748 | MarwenElarbi | Permutation (APIO22_perm) | C++17 | 10 ms | 1372 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 = 62; i > 0; --i)
{
while(k>=(1LL<<i)-1){
k-=(1LL<<i)-1;
tab.pb(i);
cnt+=i;
}
}
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... |