제출 #973767

#제출 시각아이디문제언어결과실행 시간메모리
973767Pannda순열 (APIO22_perm)C++17
91.33 / 100
1 ms440 KiB
#include "perm.h"

#include <bits/stdc++.h>
using namespace std;

vector<int> construct_permutation(long long k) {
    int b = 63 - __builtin_clzll(k);
    k -= 1LL << b;
    int c = __builtin_popcountll(k);
    vector<int> key(b);
    iota(key.begin(), key.end(), c);
    for (int i = 0; i < c; i++) {
        int a = 63 - __builtin_clzll(k & -k);
        k -= 1LL << a;
        key.insert(key.begin() + b - a, i);
    }
    return key;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...