Submission #984751

# Submission time Handle Problem Language Result Execution time Memory
984751 2024-05-17T04:30:44 Z Uultan12 Permutation (APIO22_perm) C++17
0 / 100
1 ms 344 KB
#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 -