제출 #1065489

#제출 시각아이디문제언어결과실행 시간메모리
1065489Gangsta순열 (APIO22_perm)C++17
10 / 100
1 ms348 KiB
#include "bits/stdc++.h" #define ll long long int #define pb push_back #define pii pair<int,int> #define ff first #define ss second #define sz size() using namespace std; ll tap(int n){ ll sum = (1<<n); return sum-1; } vector <int> construct_permutation(ll k){ k--; int cnt = 0; deque <int> d; vector <int> v; while(k>0){ int l = 1, r = 58, md, jog = -1; ll jog1 = -1; while(l <= r){ md = (l+r)/2; ll san = tap(md); if(san <= k){ jog = md; jog1 = san; l = md + 1; } else r = md - 1; } if(jog != -1){ k -= jog1; for(int i = cnt+jog-1; i >= cnt; i--) d.push_front(i); cnt += jog; } } while(!d.empty()){ v.pb(d.front()); d.pop_front(); } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...