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 = -1;
deque <int> v2;
bool tr = 1;
while(k > 0){
vector <int> v1;
ll k1 = 2;
x++;
v1.push_back(x);
while((k1-1+tr) < k){
if(k/2 < (k1-1+tr)) break;
x++;
v1.push_back(x);
k1 *= 2;
}
k -= (k1-1+tr);
for(int i = sz(v1)-1; i >= 0; i--){
v2.push_front(v1[i]);
}
tr = 0;
}
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... |