Submission #982845

#TimeUsernameProblemLanguageResultExecution timeMemory
982845alo_54Permutation (APIO22_perm)C++17
0 / 100
1 ms348 KiB
//#include "perm.h" #include <bits/stdc++.h> using namespace std; void print(vector <int> r) { cout<<"..."<<endl; for(auto i : r) { cout<<i<<" "; } cout<<endl; } std::vector<int> construct_permutation(long long k) { vector <int> resp; long long cont = 0, prev = 1; while (prev <= k) { cont++; prev *= 2; } cont --; long long aux = pow(2, cont); int c = cont + 1; //cout<<"cont: "<<cont<<endl; for (long long i = aux + 1; i <= k; i ++) { resp.push_back(c); c++; } reverse(resp.begin(), resp.end()); //print(resp); for (int i = 0; i < cont; i++) { resp.push_back(i); } return resp; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...