# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
630183 | Ooops_sorry | Permutation (APIO22_perm) | C++17 | 2 ms | 384 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<bits/stdc++.h>
using namespace std;
mt19937 rnd(51);
#define ll long long
#define pb push_back
#define ld long double
vector<int> construct_permutation(long long k)
{
if (k == 1) {
return {};
}
if (k == 2) {
return {0};
}
for (auto d : {2, 3, 5, 7, 11, 13, 17}) {
if (k % d == 0 && k > d) {
vector<int> a = construct_permutation(k / d), b = construct_permutation(d);
for (int i = 0; i < b.size(); i++) {
b[i] += a.size();
}
for (int i = 0; i < b.size(); i++) {
a.pb(b[i]);
}
return a;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |