#include<bits/stdc++.h>
#include "perm.h"
using namespace std;
#ifdef LOCAL
#include "debug.cpp"
#else
#define debug(...)
#endif
#define ll long long
vector<int> construct_permutation(long long k) {
ll size = __lg(k);
vector<int> perm(size);
for(int i = 0; i < size; i++){
perm[i] = i;
}
k-=(1ll << size);
ll insert = size;
while(k > 0){
ll ind = __lg(k);
k-=(1ll << ind);
perm.insert(perm.begin() + ind, insert);
insert++;
}
debug(perm);
return perm;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Partially correct |
1 ms |
344 KB |
Partially correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Partially correct |
1 ms |
348 KB |
Partially correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Partially correct |
2 ms |
344 KB |
Partially correct |
11 |
Partially correct |
2 ms |
348 KB |
Partially correct |
12 |
Partially correct |
1 ms |
488 KB |
Partially correct |
13 |
Partially correct |
1 ms |
348 KB |
Partially correct |