QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#546914#4252. Permutation251Sec0 14ms3836kbC++14535b2024-09-04 15:50:192024-09-04 15:50:20

Judging History

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

  • [2024-09-04 15:50:20]
  • 评测
  • 测评结果:0
  • 用时:14ms
  • 内存:3836kb
  • [2024-09-04 15:50:19]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
vector<int> solve(ll k) {
	if (k <= 4) {
		vector<int> a;
		while (--k) a.push_back(n++);
		reverse(a.begin(), a.end());
		return a;
	}
	vector<int> a = solve(k / 4);
	if (k % 2 == 0) {
		a = solve(k / 2), a.push_back(n++);
	}
	else if (k % 4 == 1) {
		a = solve(k - 1), a.insert(a.begin(), n++);
	}
	else {
		a = solve(k - 3), a.insert(a.begin() + 2, n++);
	}
	return a;
}
vector<int> construct_permutation(ll k) {
	return solve(k);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

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
2 1
3
5 4 3
4
9 8 7 6
3
11 10 12
4
15 14 16 13
4
20 19 18 21
5
28 26 25 24 27
5
33 32 31 30 34
5
39 38 41 37 40
4
45 44 46 47
5
56 53 52 54 55
5
61 60 62 59 63
5
69 68 72 70 71
5
79 78 77 80 81
6
94 91 90 89 92 93
6
104 102 101 100 103 105
6
115 114 118 ...

result:

wrong answer Integer 2 violates the range [0, 1]

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 14ms
memory: 3836kb

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
21
7572 7565 7556 7568 7554 7559 7553 7552 7555 7557 7558 7560 7561 7562 7563 7564 7566 7567 7569 7570 7571
23
24491 24476 24472 24488 24483 24479 24471 24470 24469 24473 24474 24475 24477 24478 24480 24481 24482 24484 24485 24486 24487 24489 24490
21
32188 32...

result:

wrong answer Integer 7572 violates the range [0, 20]