Submission #969667

#TimeUsernameProblemLanguageResultExecution timeMemory
969667antonPermutation (APIO22_perm)C++17
91.33 / 100
1 ms600 KiB
#include "perm.h" #include<bits/stdc++.h> using namespace std; #define pii pair<int, int> #define ll long long const int MAX_N = 1e3; void construct_k(ll k, int m, vector<int>& v){ if(k == 0LL || k== 1LL){ return; } else{ if(k%2LL == 0LL){ v.push_back(m++); construct_k(k/2LL, m, v); } else{ construct_k(k-1LL, m+1, v); v.push_back(m); } } } std::vector<int> construct_permutation(long long k) { vector<int> res; construct_k(k, 0, res); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...