QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#734807#4252. Permutationninjadoggy12340 1ms3908kbC++20894b2024-11-11 15:12:142024-11-11 15:12:15

Judging History

你现在查看的是最新测评结果

  • [2024-11-11 15:12:15]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3908kb
  • [2024-11-11 15:12:14]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#include "perm.h"

vector<int> construct_permutation(long long k) {
	k--;
	if (k == 1) {
		return { 0 };
	}
	int num = 2;
	vector<int> arr = { 1,0 };
	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;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3860kb

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
0
2
1 0
3
2 1 0
5
1 0 2 3 4
6
3 1 0 2 4 5
6
4 1 0 2 3 5
6
1 0 3 2 4 5
6
1 0 2 3 4 5
7
4 1 0 2 3 5 6
7
5 1 0 2 3 4 6
7
1 0 4 2 3 5 6
7
2 1 0 3 4 5 6
8
5 2 1 0 3 4 6 7
8
6 2 1 0 3 4 5 7
8
2 1 5 0 3 4 6 7
7
1 0 2 3 4 5 6
8
5 1 0 2 3 4 6 7
8
6 1 0 2 3 4 5 7
8
1 ...

result:

wrong answer 

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 1ms
memory: 3908kb

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
18 4 1 14 7 0 2 3 5 6 8 9 10 11 12 13 15 16 17 19 20 21
24
12 3 19 14 1 8 0 2 4 5 6 7 9 10 11 13 15 16 17 18 20 21 22 23
22
17 11 1 0 7 4 2 3 5 6 8 9 10 12 13 14 15 16 18 19 20 21
22
20 14 4 16 1 8 0 2 3 5 6 7 9 10 11 12 13 15 17 18 19 21
23
6 2 20 17 14 11...

result:

wrong answer