Submission #745132

# Submission time Handle Problem Language Result Execution time Memory
745132 2023-05-19T12:23:35 Z Desh03 Permutation (APIO22_perm) C++17
91.3333 / 100
2 ms 340 KB
#include <bits/stdc++.h>
using namespace std;

vector<int> construct_permutation(long long k) {
    int lg = 0;
    while ((1LL << (lg + 1)) <= k) ++lg;
    vector<int> ans(lg, -1), ret;
    int j = lg;
    for (int i = lg - 1; i >= 0; --i)
        if (k >> i & 1)
            ans[i] = j++;
    for (int i = 0; i < lg; i++) {
        if (ans[i] ^ -1) ret.push_back(ans[i]);
        ret.push_back(i);
    }
    return ret;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Partially correct 1 ms 340 KB Partially correct
6 Correct 2 ms 300 KB Output is correct
7 Correct 1 ms 296 KB Output is correct
8 Partially correct 2 ms 340 KB Partially correct
9 Correct 1 ms 340 KB Output is correct
10 Partially correct 2 ms 340 KB Partially correct
11 Partially correct 2 ms 340 KB Partially correct
12 Partially correct 1 ms 340 KB Partially correct
13 Partially correct 2 ms 340 KB Partially correct