답안 #976009

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
976009 2024-05-06T04:58:29 Z Orifkhon 순열 (APIO22_perm) C++17
91.3333 / 100
2 ms 348 KB
#include<bits/stdc++.h>
#include "perm.h"

using namespace std;
#ifdef LOCAL
#include "debug.cpp"
#else
#define debug(...) 
#endif
#define ll long long


vector<int> construct_permutation(long long k) {
    ll size = 63 - __builtin_clzll(k);

    vector<int> perm(size);
    for(int i = 0; i < size; i++){
        perm[i] = i;
    }	
    k-=(1ll << size);
    ll insert = size;
    while(k > 0){
        ll ind =  63 - __builtin_clzll(k);
        k-=(1ll << ind);
        perm.insert(perm.begin() + ind, insert);
        insert++;
    }
    debug(perm);
    return perm;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Partially correct 1 ms 348 KB Partially correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Partially correct 1 ms 348 KB Partially correct
9 Correct 1 ms 348 KB Output is correct
10 Partially correct 2 ms 348 KB Partially correct
11 Partially correct 1 ms 348 KB Partially correct
12 Partially correct 1 ms 348 KB Partially correct
13 Partially correct 1 ms 348 KB Partially correct