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 ll long long
#define sz(s) (int)s.size()
vector<int> construct_permutation(ll k){
int x = 0;
deque <int> v2;
bool tr = 0;
while(k > 0){
vector <int> v1;
ll k1 = 1;
if(tr == 0) k1 += 1;
tr = 1;
v1.push_back(x);
while(k1 < k){
if(k/2 < k1) break;
x++;
v1.push_back(x);
k1 *= 2;
}
k -= k1;
for(int i = sz(v1)-1; i >= 0; i--){
v2.push_front(v1[i]);
}
}
vector <int> v;
for(int i = 0; i < sz(v2); i++){
v.push_back(v2[i]);
}
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |