# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
623524 | Lobo | Permutation (APIO22_perm) | C++17 | 2 ms | 352 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<iostream>
#include<vector>
#include<deque>
#include<math.h>
using namespace std;
#define pb push_back
#define pf push_front
#define int long long
vector<int32_t> construct_permutation(int k)
{
vector<int32_t> seq;
int lg = 0;
for(int i = 0; i <= 60; i++) {
if(k >= (1LL<<i)) lg = i;
}
if(lg < 2) {
for(int i = k-2; i >= 0; i--) {
seq.pb(i);
}
return seq;
}
deque<int> ans;
int cur = 0;
//do the first 2/3 separate
if((1LL<<(lg-1))&k) {
//begins with 11
ans.pb(cur++); //10
ans.pf(cur++); //11
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |