#include <vector>
#include <algorithm>
std::vector<int> construct_permutation(long long k) {
int n = 1;
while ((n * (n + 1)) / 2 < k) {
++n;
}
std::vector<int> permutation(n);
for (int i = 0; i < k; ++i) {
permutation[i] = i;
}
// Fill the remaining elements with values not used in the increasing subsequence
int next_value = k;
for (int i = k; i < n; ++i) {
permutation[i] = next_value++;
}
return permutation;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |