# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
955684 | Otalp | 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 "perm.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
vector<int> construct_permutation(ll k)
{
vector<int> ans;
ll h = k - 1;
vector<int> d;
ll ls = -1;
for(int i=60; i>=1; i--){
while(h >= (1ll << i) - 1){
d.pb(i);
ls += i;
h -= (1ll << i) - 1;
}
}
if(h > 0) d.pb(1), ls ++;
for(auto x: d){
int l=ls-x+1, r=ls;
ls -= x;
for(int i=l; i<=r; i++){
ans.pb(i);
}
}
for(int i=0; i<d.size(); i++){
//cout<<d[i]<<' ';
}
//cout<<'\n';
for(int i=0; i<ans.size(); i++){
//cout<<ans[i]<<' ';
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |