Submission #601325

#TimeUsernameProblemLanguageResultExecution timeMemory
601325IvanJPermutation (APIO22_perm)C++17
91.33 / 100
3 ms340 KiB
#include<bits/stdc++.h> #include "perm.h" #define pb push_back #define all(a) (a).begin(), (a).end() using namespace std; typedef long long ll; vector<int> construct_permutation(ll k) { deque<int> q; vector<int> v; for(;k > 1;k >>= 1) { if(k & 1) v.pb(0); v.pb(1); } reverse(all(v)); int num = 0; for(int i : v) if(i) q.pb(num++); else q.push_front(num++); vector<int> p; while(q.size()) p.pb(q.front()), q.pop_front(); return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...