| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1362730 | serendipitous | 순열 (APIO22_perm) | C++20 | 4 ms | 1508 KiB |
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
std::vector<int> construct_permutation(long long k)
{
ll kcpy = k-1;
vector<int> sizes;
int len = 0;
int e = __lg(k)+1;
while(kcpy > 0) {
while((1LL << e)-1 > kcpy) --e;
len += e;
sizes.push_back(e);
kcpy -= (1LL << e)-1;
}
// cerr << "len = " << len << endl;
vector<int> p;
int end = len;
for(int s: sizes) {
for(int i = end - s + 1; i <= end; ++i) {
p.push_back(i-1);
}
end -= s;
}
return p;
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
