| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 973886 | Pannda | Permutation (APIO22_perm) | C++17 | 2 ms | 668 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> construct_permutation(long long k) {
int b = 63 - __builtin_clzll(k);
k -= 1LL << b;
vector<int> key(b);
iota(key.begin(), key.end(), 0);
int cnt = 0;
while (k > 0) {
b = 63 - __builtin_clzll(k);
if (cnt >= 1 && b > 0 && ((k >> (b - 1)) & 1)) {
b--;
for (int &v : key) {
if (v >= b) v++;
}
key.insert(key.end() - 2, b);
k -= 3LL << b;
} else {
for (int &v : key) {
if (v >= b) v++;
}
key.push_back(b);
k -= 1LL << b;
cnt++;
}
}
return key;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
