제출 #1035332

#제출 시각아이디문제언어결과실행 시간메모리
1035332amine_aroua순열 (APIO22_perm)C++17
64.62 / 100
10 ms1624 KiB
#include "perm.h" #include<bits/stdc++.h> using namespace std; #define ll long long std::vector<int> construct_permutation(long long k) { k--; int n = 0; vector<int> bits; for(ll i = 0 ; i < 60 ; i++) { if((1ll<<i) & k) { bits.push_back(i); n+=i + 1; } } n--; vector<int> perm; for(auto i : bits) { for(int j = n - i + 1 ; j <= n ; j++) { perm.push_back(j); } n-=i; } while(n >= 0) { perm.push_back(n); n--; } return perm; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...