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 <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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |