# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
574046 | Stickfish | Permutation (APIO22_perm) | C++17 | 2 ms | 340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "perm.h"
#include <algorithm>
using ll = long long;
using namespace std;
const int MAXVAL = 50001;
vector<int> construct_permutation(ll k) {
int mxlast = MAXVAL;
int mnlast = -1;
vector<int> ans;
while (k > 1) {
if (k % 2 == 0) {
ans.push_back(++mnlast);
k /= 2;
} else if (k % 3 == 0) {
ans.push_back(mnlast + 2);
ans.push_back(mnlast + 1);
k /= 3;
mnlast += 2;
} else if (k % 5 == 0) {
ans.push_back(mnlast + 3);
ans.push_back(mnlast + 1);
ans.push_back(mnlast + 2);
k /= 5;
mnlast += 3;
} else if (k % 23 == 0) {
//2 3 5 1 6 4
ans.push_back(mnlast + 2);
ans.push_back(mnlast + 3);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |