# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
574046 | Stickfish | 순열 (APIO22_perm) | C++17 | 2 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "perm.h"
#include <algorithm>
using ll = long long;
using namespace std;
const int MAXVAL = 50001;
vector<int> construct_permutation(ll k) {
int mxlast = MAXVAL;
int mnlast = -1;
vector<int> ans;
while (k > 1) {
if (k % 2 == 0) {
ans.push_back(++mnlast);
k /= 2;
} else if (k % 3 == 0) {
ans.push_back(mnlast + 2);
ans.push_back(mnlast + 1);
k /= 3;
mnlast += 2;
} else if (k % 5 == 0) {
ans.push_back(mnlast + 3);
ans.push_back(mnlast + 1);
ans.push_back(mnlast + 2);
k /= 5;
mnlast += 3;
} else if (k % 23 == 0) {
//2 3 5 1 6 4
ans.push_back(mnlast + 2);
ans.push_back(mnlast + 3);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |