#include "perm.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define X first
#define Y second
#define SZ(a) ((int)a.size())
#define ALL(v) v.begin(), v.end()
#define pb push_back
vector<int> construct_permutation(ll k) {
vector<int> idx, rt;
--k;
for (ll x = 59; x > 0; --x) {
while (k >= (1LL << x) - 1) {
k -= (1LL << x) - 1;
idx.pb(x);
}
}
int nw = -1;
for (int x : idx) {
for (int i = nw + x; i > nw; --i)
rt.pb(i);
nw += x;
}
reverse(ALL(rt));
return rt;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Partially correct |
1 ms |
340 KB |
Partially correct |
4 |
Partially correct |
1 ms |
340 KB |
Partially correct |
5 |
Partially correct |
4 ms |
540 KB |
Partially correct |
6 |
Partially correct |
5 ms |
596 KB |
Partially correct |
7 |
Partially correct |
7 ms |
852 KB |
Partially correct |
8 |
Partially correct |
10 ms |
1080 KB |
Partially correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Partially correct |
11 ms |
1364 KB |
Partially correct |
11 |
Partially correct |
10 ms |
984 KB |
Partially correct |
12 |
Partially correct |
8 ms |
852 KB |
Partially correct |
13 |
Partially correct |
9 ms |
980 KB |
Partially correct |