Submission #1117720

#TimeUsernameProblemLanguageResultExecution timeMemory
1117720ereringPermutation (APIO22_perm)C++17
0 / 100
1 ms336 KiB
#include <bits/stdc++.h> #include "perm.h" using namespace std; #define endl '\n' #define pb push_back bool flag=1; int a[300]; vector<int> construct_permutation(long long k) { if(k>50)exit(1); long long cnt=1,f=0; for(long long i=62;i>=0;i--){ if((k>>i)&1){ // cout<<i<<' '<<(k>>i)<<' '<<k<<endl; if(cnt==1){ for(int j=1;cnt<=i;j+=2){ a[j]=cnt++; a[j]+=200; } f=2; continue; } else{ a[f]=-1; } f+=2; } } vector<int> v; int s=1; for(int i=299;i>=0;i--){ if(a[i]==-1)a[i]=s++; } for(int i=0;i<300;i++){ if(a[i]!=0){ if(a[i]>=200){ a[i]=a[i]-200+s-1; // cout<<a[i]<<'s'<<endl; } v.pb(a[i]-1); } } return v; } /*signed main() { vector<int> v=construct_permutation(7); cout<<endl; for(auto i:v)cout<<i<<' '; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...