QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#734802 | #4252. Permutation | ninjadoggy1234 | 0 | 1ms | 3844kb | C++20 | 894b | 2024-11-11 15:10:13 | 2024-11-11 15:10:14 |
answer
#include <bits/stdc++.h>
using namespace std;
#include "perm.h"
vector<int> construct_permutation(long long k) {
k--;
if (k == 1) {
return { 1 };
}
int num = 3;
vector<int> arr = { 2,1 };
vector<int> nums;
while (k > 0) {
int dig = k % 4;
nums.insert(nums.begin(), dig);
k /= 4;
}
auto Add1 = [&]() {arr.insert(arr.begin(), num++); };
auto Add3 = [&]() {arr.insert(arr.begin() + 2, num++); };
auto Times2 = [&]() {arr.push_back(num++); };
if (nums[0] == 1) {
Add3();
} else {
if (nums[0] == 3) {
Add1();
}
if (nums.size() > 1) {
Times2();
Times2();
}
}
for (int ind = 1; ind < nums.size(); ind++) {
if (nums[ind] == 2) {
Times2();
Add1();
Times2();
} else {
if (nums[ind] == 1) {
Add1();
} else if (nums[ind] == 3) {
Add3();
}
Times2();
Times2();
}
}
return arr;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3776kb
input:
a92b3f80-b312-8377-273c-3916024d7f2a 89 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
output:
6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf OK 1 1 2 2 1 3 3 2 1 5 2 1 3 4 5 6 4 2 1 3 5 6 6 5 2 1 3 4 6 6 2 1 4 3 5 6 6 2 1 3 4 5 6 7 5 2 1 3 4 6 7 7 6 2 1 3 4 5 7 7 2 1 5 3 4 6 7 7 3 2 1 4 5 6 7 8 6 3 2 1 4 5 7 8 8 7 3 2 1 4 5 6 8 8 3 2 6 1 4 5 7 8 7 2 1 3 4 5 6 7 8 6 2 1 3 4 5 7 8 8 7 2 1 3 4 5 6 8 8 2 ...
result:
wrong answer Integer 1 violates the range [0, 0]
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 1ms
memory: 3844kb
input:
a92b3f80-b312-8377-273c-3916024d7f2a 100 39993 85709 48645 25391 15360 54084 28947 18808 86735 316 14357 82845 96210 16242 58466 43439 77462 70742 76176 20397 30314 22634 29622 81835 31904 81283 37072 36527 26764 55878 72762 5262 34915 63468 20595 66579 77373 36670 89340 83384 73268 31960 67318 3908...
output:
6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf OK 22 19 5 2 15 8 1 3 4 6 7 9 10 11 12 13 14 16 17 18 20 21 22 24 13 4 20 15 2 9 1 3 5 6 7 8 10 11 12 14 16 17 18 19 21 22 23 24 22 18 12 2 1 8 5 3 4 6 7 9 10 11 13 14 15 16 17 19 20 21 22 22 21 15 5 17 2 9 1 3 4 6 7 8 10 11 12 13 14 16 18 19 20 22 23 7 3 21 18 1...
result:
wrong answer Integer 22 violates the range [0, 21]