제출 #980544

#제출 시각아이디문제언어결과실행 시간메모리
980544Nexus순열 (APIO22_perm)C++17
10 / 100
1 ms348 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; const ll N=1e6+9,M=2e18+9,mod=1e9+7; ll a[66],q,k,x,y,z; vector<int>v; vector<int>construct_permutation(ll k) { x=(ll)log2(k); v.clear(); y=x-1; k-=pow(2,x); for(ll i=62;i>=0;--i) { if(k>=pow(2,i))k-=pow(2,i),a[i]=1,++y;else a[i]=0; } for(ll i=0;i<x;++i) { if(a[i])v.push_back((ll)y),--y; v.push_back((ll)i); } return v; } /* int main() { ios::sync_with_stdio(0); //cin.tie(0);cout.tie(0); cin>>q; while(q--) { cin>>k; vector<int>g=construct_permutation(k); for(auto i:g)cout<<i<<' '; cout<<'\n'; } } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...