Submission #957695

#TimeUsernameProblemLanguageResultExecution timeMemory
957695pragmatistPermutation (APIO22_perm)C++17
91.33 / 100
2 ms348 KiB
#include "perm.h" #include<bits/stdc++.h> using namespace std; mt19937 rng(time(NULL)); std::vector<int> construct_permutation(long long k) { vector<int> v, ans; for(int i = 0; i <= 60; ++i) { if(k >> i & 1) { v.push_back(i); } } for(int i = 0; i < v.back(); ++i) { ans.push_back(i); } int timer = v.back(); for(int i = (int)v.size()-2; i >= 0; --i) { ans.insert(ans.begin()+v[i], timer++); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...