# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
737670 | tegid | 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb emplace_back
vector<int> construct_permutation(ll k){
if(k<=4){
if(k==2)return {0};
if(k==3)return {1, 0};
if(k==4)return {0, 1};
return {};
}else{
if(k%2==0){
vector<int> v=construct_permutation(k/2);
vector<int> ans;
ans.pb(0);
for(int i=0;i<(int)v.size();i++)ans.pb(v[i]+1);
return ans;
}else if(k%3==0){
vector<int> v=construct_permutation(k/3);
vector<int> ans;
ans.pb(1);
ans.pb(0);
for(int i=0;i<(int)v.size();i++)ans.pb(v[i]+2);
return ans;
}else if (k%5==0){
vector<int> v=construct_permutation(k/5);
vector<int> ans;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |