Submission #969666

#TimeUsernameProblemLanguageResultExecution timeMemory
969666antonPermutation (APIO22_perm)C++17
10 / 100
160 ms262144 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(int k, int m, vector<int>& v){ if(k == 0 || k== 1){ return; } else{ if(k%2 == 0){ v.push_back(m++); construct_k(k/2, m, v); } else{ construct_k(k-1, 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...