# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1202186 | dzuizz | Permutation (APIO22_perm) | C++20 | 46 ms | 7140 KiB |
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> construct_permutation(long long k){
vector<int> p;
int n=0;
for(int x=2;x<=(int)sqrtl(k);++x){
if(k%x) continue;
int c=0;
while(k%x==0) k/=x,++c;
for(int i=0;i<c;++i){
for(int j=n+x-2;j>=n;--j)
p.emplace_back(j);
n+=x-1;
}
}
if(k>1) for(int i=n+k-2;i>=n;--i)
p.emplace_back(i);
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |