#include "perm.h"
#include <bits/stdc++.h>
#define pb(x) push_back((x))
using namespace std;
using ll = long long;
std::vector<int> construct_permutation(long long k) {
vector<int> x;
ll currSum = 1;
for (int i = 0; currSum + (1 << i) <= k; i++) {
x.pb(i);
currSum += (1 << i);
}
for (int i = 1; i <= (k - currSum); i++) x.pb(-i);
for (int& i : x) i += k - currSum;
return x;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
124 ms |
12272 KB |
Integer 7240 violates the range [1, 5000] |
4 |
Halted |
0 ms |
0 KB |
- |