| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1360260 | Davdav1232 | 순열 (APIO22_perm) | C++20 | 2 ms | 344 KiB |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#include "perm.h"
std::vector<int> construct_permutation(long long k)
{
int n=0;
ll K=k;
vector<bool> ord;
while(K>1){
if(K%2==1){
K--;
n++;
ord.push_back(1);
}
else{
K/=2;
n++;
ord.push_back(0);
}
}
reverse(ord.begin(), ord.end());
vector<int> ans(n);
deque<int> a;
for(int i=0; i<n; i++){
if(ord[i]==0){
a.push_front(n-i-1);
}
else a.push_back(n-i-1);
}
for(int i=0; i<n; i++){
ans[i]=a.front();
a.pop_front();
}
return ans;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
