# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
975521 | 2024-05-05T11:55:49 Z | KK_1729 | 순열 (APIO22_perm) | C++17 | 2 ms | 524 KB |
#include "perm.h" #include <bits/stdc++.h> using namespace std; int min(int x, int y){ if (x < y) return x; return y; } std::vector<int> construct_permutation(long long k) { vector<int> a; while (k > 2){ if (k%2 == 1){ a.push_back(1); k--; }else{ a.push_back(0); k/=2; } } reverse(a.begin(), a.end()); int mini = -1; int maximum = 1; vector<int> ans; ans.push_back(0); for (auto x: a){ if (x == 0){ ans.push_back(maximum); maximum++; }else{ ans.push_back(mini); mini--; } } int u = 1e9; for (auto x: ans){ if (x < u) u = x; } if (u > 0){ return ans; } for (int i = 0; i < ans.size(); ++i) ans[i] += abs(u); return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Partially correct | 1 ms | 348 KB | Partially correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Partially correct | 2 ms | 524 KB | Partially correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Partially correct | 1 ms | 348 KB | Partially correct |
11 | Partially correct | 1 ms | 348 KB | Partially correct |
12 | Partially correct | 1 ms | 432 KB | Partially correct |
13 | Partially correct | 2 ms | 348 KB | Partially correct |