제출 #984751

#제출 시각아이디문제언어결과실행 시간메모리
984751Uultan12순열 (APIO22_perm)C++17
0 / 100
1 ms344 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...