Submission #897031

#TimeUsernameProblemLanguageResultExecution timeMemory
897031LitusianoPermutation (APIO22_perm)C++17
64.62 / 100
11 ms1640 KiB
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math,inline") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,lzcnt,mmx,abm,avx,avx2,fma") #include<bits/stdc++.h> // #include "perm.h" using namespace std; vector<int> construct_permutation(long long k) { k--; int sz = 0; for(int i = 0; i<62; i++){ if(k & (1ll<<i)) sz+=i+1; } for(int i = 0; i<sz; i++){ // k-=sz-i; } // sz--; vector<int> v; for(int i = 0; i<sz; i++) v.push_back(i); reverse(v.begin(),v.end()); // for(int i = 0; i<v.size(); i++) cout<<v[i]<<" "; cout<<endl; int act = 0; for(int i = 0; i<62; i++){ if(k & (1ll<<i)){ reverse(v.begin()+act,v.begin()+act+i); act++; act+=i; } } // if(k%2 == 1) v.pop_back(); // for(int i = 0; i<v.size(); i++) cout<<v[i]<<" "; cout<<endl; return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...