QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#460751#4252. Permutationmakrav94.666667 1ms3876kbC++20884b2024-07-02 06:28:442024-07-02 06:28:45

Judging History

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

  • [2024-07-02 06:28:45]
  • 评测
  • 测评结果:94.666667
  • 用时:1ms
  • 内存:3876kb
  • [2024-07-02 06:28:44]
  • 提交

answer

#include "perm.h"
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

vector<int> sol(ll x) {
	if (x == 0) return {};
	if (x % 3 == 2) {
		auto rs = sol((x-2)/3);
		rs.push_back(rs.size() + 1);
		rs.push_back(rs.size()-1);
		return rs;
	}
	if (x % 5 == 4) {
		auto rs= sol((x-4)/5);
		rs.push_back(rs.size()+1);
		rs.push_back(rs.size()+1);
		rs.push_back(rs.size()-2);
		return rs;
	}
	if (x % 3 == 0) {
		auto rs = sol((x-3)/3);
		for(auto&u:rs)u++;
		rs.push_back(rs.size()+2);
		rs.push_back(rs.size());
		rs.push_back(0);
		return rs;
	}
	if (x % 2 == 0) {
		auto rs = sol((x-2)/2);
		for(auto&u:rs)u++;
		rs.push_back(rs.size()+1);
		rs.push_back(0);
		return rs;
	} else {
		auto rs = sol((x-1)/2);
		rs.push_back(rs.size());
		return rs;
	}
}

vector<int> construct_permutation(long long k) {
	return sol(k - 1);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1ms
memory: 3872kb

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

result:

ok 

Subtask #2:

score: 84.6667
Acceptable Answer

Test #2:

score: 90
Accepted
time: 0ms
memory: 3796kb

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

result:

ok 

Test #3:

score: 90
Accepted
time: 1ms
memory: 3736kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
2147483647
1073741823
536870911
268435455
134217727
67108863
33554431
16777215
8388607
4194303
2097151
1582
24319
38
463
7
1073741503
3
18
3
3780
2
24934
124910
65535
154
1069539071
209452285
1662
3
3
93
4070
131071
502986749
3164
268430159
247
21746
124927
1...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
48
11 10 9 12 14 15 13 17 16 8 18 20 19 7 22 21 6 24 25 23 27 26 5 29 28 31 30 33 32 4 35 34 37 36 3 39 40 38 41 2 43 42 1 45 44 47 46 0
47
11 12 10 14 13 9 16 15 8 18 19 17 21 20 7 23 22 6 25 24 5 26 28 29 27 31 30 4 33 34 32 36 35 3 38 39 37 40 2 41 1 42 0 4...

result:

ok 

Test #4:

score: 89
Acceptable Answer
time: 1ms
memory: 3752kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
576460752303423487
288230376151711743
144115188075855871
72057594037927935
36028797018963967
18014398509481983
9007199254740991
4503599627370495
2251799813685247
1125899906842623
562949953421311
8166608599550
16508780543
33554427
43000192155799
62353919
71773...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
93
21 22 20 23 19 25 24 18 27 28 26 30 31 29 33 32 17 35 34 16 37 36 39 38 41 40 15 43 42 45 44 14 47 46 13 49 48 12 50 52 51 54 53 11 56 55 10 57 59 58 61 60 9 62 63 8 65 64 67 66 7 69 68 6 71 72 70 74 75 73 77 76 79 78 5 81 80 4 83 82 3 84 86 85 2 88 87 90 8...

result:

points 0.98888888890

Test #5:

score: 90
Accepted
time: 1ms
memory: 3876kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
336455856505
197522918480
260689715591
857530435844
89809708292
207893569808
702779448503
917149928374
643600357316
927175148543
51879726697
974331197849
721971572596
902469653832
936157710917
714588060426
276939435899
393954173900
692525720126
762289367234
1...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
58
13 12 11 15 14 10 16 18 17 9 20 19 22 21 8 23 25 24 7 26 27 6 28 5 30 29 4 32 31 3 34 33 36 35 2 38 37 40 39 42 41 44 43 46 45 1 47 49 50 48 52 53 51 54 0 56 57 55
55
10 9 8 12 13 11 15 16 14 18 17 7 19 21 20 23 22 6 24 26 27 25 29 30 28 31 5 33 34 32 36 35...

result:

ok 

Test #6:

score: 90
Accepted
time: 1ms
memory: 3772kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
330061280882697
570108406837011
246465711199350
844437948491708
542197441405836
481743322695013
913237337833838
634038564781156
969749245791701
445335878892049
722391184659757
25600568975288
304176471716316
934030664268458
770565383569314
38589802113902
56387...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
74
15 16 14 17 13 19 18 12 21 22 20 24 23 11 25 27 26 10 29 30 28 32 33 31 35 34 37 36 9 39 40 38 41 8 43 42 7 45 44 6 47 46 49 48 51 50 5 52 54 53 4 56 55 58 57 60 59 3 62 63 61 65 64 2 67 66 1 69 68 0 71 70 73 72
77
18 20 19 22 21 17 24 23 26 25 16 27 28 15 ...

result:

ok 

Test #7:

score: 87.3333
Acceptable Answer
time: 1ms
memory: 3828kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
9808783958425241
800256975993528789
891794666437715812
154809014071580277
262143300778136084
508038278751820218
855062810898478629
196129157832150290
519747744582635554
544132224659269080
335568667826635843
978219202156109836
887928188166976766
57068450616591...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
83
20 22 21 19 24 23 18 25 26 17 28 29 27 31 30 33 32 35 34 16 36 38 37 15 39 40 14 41 13 42 12 43 11 44 10 46 45 9 48 47 50 49 8 51 53 52 7 54 55 6 57 56 5 58 60 61 59 63 62 65 64 4 67 68 66 70 69 3 72 71 2 74 73 76 75 78 77 1 80 81 79 82 0
92
21 22 20 23 19 ...

result:

points 0.97037037040

Test #8:

score: 88.6667
Acceptable Answer
time: 1ms
memory: 3768kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
576460752303423488
576460752303423489
576460752303423490
576460752303423491
576460752303423492
576460752303423493
576460752303423494
576460752303423495
576460752303423496
576460752303423497
576460752303423498
576460752303423499
576460752303423500
576460752303...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
94
23 25 24 27 26 22 28 29 21 31 30 20 33 32 19 35 34 18 36 37 17 38 16 40 39 15 41 43 42 14 44 46 45 48 47 13 50 51 49 53 52 55 54 12 57 56 11 59 58 10 61 62 60 63 9 65 64 8 66 68 69 67 71 70 73 72 7 75 76 74 77 6 79 78 5 81 80 4 82 84 83 3 86 85 2 88 89 87 9...

result:

points 0.98518518520

Test #9:

score: 87.6667
Acceptable Answer
time: 1ms
memory: 3772kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
999999999999999901
999999999999999902
999999999999999903
999999999999999904
999999999999999905
999999999999999906
999999999999999907
999999999999999908
999999999999999909
999999999999999910
999999999999999911
999999999999999912
999999999999999913
999999999999...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
96
23 25 24 22 27 26 21 29 28 31 30 20 33 32 35 34 19 37 36 18 39 38 17 41 40 16 43 44 42 46 45 48 47 15 49 51 50 14 53 52 13 55 56 54 57 12 59 58 11 61 60 10 62 63 9 64 8 66 65 7 68 67 70 69 6 71 72 5 74 73 4 76 75 3 77 79 78 81 80 2 83 82 85 84 1 87 88 86 90...

result:

points 0.97407407410

Test #10:

score: 87
Acceptable Answer
time: 1ms
memory: 3792kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
333271685633113373
303681151173201623
185954994672690293
695000491456721509
680039555562404861
711731044985538439
725639770789026979
653124604194000671
716161846351295353
727816570890872159
566821251164212697
620956504691616073
845196440395453799
654653854021...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
90
21 23 22 20 24 26 25 19 27 29 28 18 30 31 17 33 32 35 34 16 37 36 39 38 15 40 42 41 44 43 14 45 46 13 47 12 49 48 51 50 11 53 52 10 55 54 9 57 56 59 58 8 61 62 60 63 7 64 6 66 65 68 67 5 69 71 70 4 73 72 3 74 76 75 78 77 80 79 2 81 83 82 85 84 87 86 1 88 89...

result:

points 0.96666666670

Test #11:

score: 88
Acceptable Answer
time: 0ms
memory: 3828kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
11260605527954640
3776579230632
1586488757700
753903936556020250
10601397297904140
810787108223734551
544021594614225000
609804018090927660
212587386929622705
334981274861463750
759012209987031
879302565815602500
156896254323644472
501935537823034315
23356411...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
79
16 17 15 18 14 20 19 13 21 23 22 25 24 12 27 28 26 29 11 31 32 30 34 33 36 35 10 37 39 40 38 42 41 9 43 45 44 8 47 46 7 48 50 49 52 51 54 53 6 55 56 5 58 57 4 59 61 60 3 62 64 63 2 65 66 1 68 67 0 69 71 72 70 74 73 76 75 78 77
65
14 16 17 15 19 18 21 20 13 ...

result:

points 0.97777777780

Test #12:

score: 84.6667
Acceptable Answer
time: 0ms
memory: 3832kb

input:

a92b3f80-b312-8377-273c-3916024d7f2a
100
450283905890997362
288230376151711743
298023223876953124
789730223053602815
558545864083284006
144115188075855871
150094635296999120
999999999999999999
505447028499293770
184884258895036415
665416609183179840
155568095557812223
437893890380859374
720575940379...

output:

6cad0f33-b1bd-3a3e-1a8d-c4af23adfcbf
OK
86
16 15 14 17 19 20 18 22 21 13 24 25 23 27 26 12 28 30 31 29 33 32 11 34 36 35 38 37 40 39 42 41 10 43 45 46 44 48 47 50 49 9 52 51 8 53 55 54 57 56 7 59 58 61 60 63 62 6 65 64 5 66 68 67 4 69 71 70 3 72 73 2 75 76 74 78 77 1 79 81 82 80 84 83 0 85
92
22 24 ...

result:

points 0.94074074070