# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
596984 | cfalas | Permutation (APIO22_perm) | C++17 | 2 ms | 340 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;
typedef vector<int> vi;
vi tr(long long k, int off){
vi a;
int cnt=62;
long long qq = (1LL<<off);
if(k<qq) return vi(5000, 0);
k-=qq;
while(k>0 && cnt>off){
while(k>=(1LL<<cnt)-qq){
k-=((1LL<<cnt)-qq);
a.push_back(cnt-off);
}
cnt--;
}
//cout<<k<<" left"<<endl;
vi b;
int p=off-1;
for(auto v : a){
for(int i=p+v;i>p;i--){
b.push_back(i);
}
p = p+v;
}
for(int i=off-1;i>=0;i--) b.push_back(i);
while(k) b.push_back(++p), k--;
reverse(b.begin(), b.end());
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |