# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
968351 | batsukh2006 | Permutation (APIO22_perm) | C++17 | 13 ms | 1628 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 int long long
#define ff first
#define ss second
vector<int> construct_permutation(long long k){
int x=0;
bool ok=0;
vector<int> v;
for(long long i=59; i>=0; i--){
if(k&(1ll<<i)){
vector<int> c;
if(ok==0){
ok=1;
for(int z=0; z<i; z++,x++){
c.push_back(x);
}
}else{
int s=0;
vector<int> t;
long long need=(1ll<<i)+1;
for(long long z=59; z>=0; z--){
if(need&(1ll<<z)){
vector<int> r;
if(z==0){
r.push_back(x);
x++;
}else{
for(int l=0; l<z; l++,x++){
r.push_back(x);
}
}
for(int j=r.size()-1; j>=0; j--){
t.push_back(r[j]);
}
}
}
for(int j=t.size()-1; j>=0; j--){
c.push_back(t[j]);
}
}
for(int j=c.size()-1; j>=0; j--){
v.push_back(c[j]);
}
}
}
reverse(v.begin(),v.end());
return v;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |