Submission #1061205

#TimeUsernameProblemLanguageResultExecution timeMemory
1061205stdfloatPermutation (APIO22_perm)C++17
64.94 / 100
10 ms1628 KiB
#include <bits/stdc++.h> #include "perm.h" // #include "grader.cpp" using namespace std; using ll = long long; vector<int> construct_permutation(ll k) { k--; int sm = -1; vector<int> v; while (k) { int x = __lg(k + 1); if (x && (rand() & 1)) x--; sm += x; v.push_back(x); k -= (1LL << x) - 1; } vector<int> ans; for (int i = 0; i < (int)v.size(); i++) { for (int j = sm - v[i] + 1; j <= sm; j++) { ans.push_back(j); } sm -= v[i]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...