제출 #734486

#제출 시각아이디문제언어결과실행 시간메모리
734486bin9638순열 (APIO22_perm)C++17
91.33 / 100
3 ms340 KiB
#include <bits/stdc++.h> #ifndef SKY #include "perm.h" #endif // SKY using namespace std; #define N 1010 #define ll long long #define fs first #define sc second #define ii pair<ll,int> #define pb push_back vector<int> construct_permutation(long long k) { int u=63-__builtin_clzll(k),n=0; //cout<<k<<" "<<u<<endl; k-=(1ll<<u); vector<int>lis[N]; for(int i=1;i<=u;i++) lis[i].pb(n++); while(k>0) { int cc=63-__builtin_clzll(k); k-=(1ll<<cc); lis[cc].pb(n++); } vector<int>kq; for(int i=0;i<=60;i++) for(auto u:lis[i]) kq.pb(u); return kq; } #ifdef SKY int main() { freopen("A.inp","r",stdin); freopen("A.out","w",stdout); ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); ll k; cin>>k; vector<int>kq=construct_permutation(k); for(auto u:kq)cout<<u<<" "; return 0; } #endif
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...