QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#783107#4252. Permutationisirazeev91.333333 2ms4120kbC++231.0kb2024-11-25 23:32:022024-11-25 23:32:04

Judging History

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

  • [2024-11-25 23:32:04]
  • 评测
  • 测评结果:91.333333
  • 用时:2ms
  • 内存:4120kb
  • [2024-11-25 23:32:02]
  • 提交

answer

#include <bits/stdc++.h>

#include "perm.h"

using namespace std;

std::vector<int> construct_permutation(long long k) {
    vector<long long> bt;
    int cnt = 0;
    for (int i = 0; i <= 60; i++) {
        if (((k >> i) & 1) == 1) {
            cnt++;
            bt.emplace_back(i);
        }
    }
    if (cnt == 1) {
        vector<int> ans;
        for (int i = 0; i < bt[0]; i++) ans.emplace_back(i);
        return ans;
    }
    cnt--;
    deque<int> res;
    int cur = 0;
    sort(bt.rbegin(), bt.rend());
    for (int i = 0; i < bt[0]; i++) res.emplace_back(i);
    cur = bt[0];
    for (int i = 1; i < (int) bt.size(); i++) {
        deque<int> new_res;
        for (int j = 0; j < bt[i]; j++) new_res.emplace_back(res[j]);
        new_res.emplace_back(cur);
        for (int j = bt[i]; j < (int) res.size(); j++) new_res.emplace_back(res[j]);
        cur++;
        res = new_res;
    }
//    for (int jj = cur; jj <= cur + cnt - 1; jj++)
//        res.push_front(jj);
    vector<int> ans;
    for (int i: res) ans.emplace_back(i);
    return ans;
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

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

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

result:

ok 

Subtask #2:

score: 81.3333
Acceptable Answer

Test #2:

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

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

result:

ok 

Test #3:

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

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

result:

ok 

Test #4:

score: 81.3333
Acceptable Answer
time: 1ms
memory: 4052kb

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
116
115 0 114 1 113 2 112 3 111 4 110 5 109 6 108 7 107 8 106 9 105 10 104 11 103 12 102 13 101 14 100 15 99 16 98 17 97 18 96 19 95 20 94 21 93 22 92 23 91 24 90 25 89 26 88 27 87 28 86 29 85 30 84 31 83 32 82 33 81 34 80 35 79 36 78 37 77 38 76 39 75 40 74 4...

result:

points 0.90370370370

Test #5:

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

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

result:

ok 

Test #6:

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

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

result:

ok 

Test #7:

score: 87.6667
Acceptable Answer
time: 0ms
memory: 3808kb

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

result:

points 0.97407407410

Test #8:

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

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
59
0 1 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
60
59 0 1 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 3...

result:

ok 

Test #9:

score: 87
Acceptable Answer
time: 2ms
memory: 3812kb

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
95 0 1 94 2 93 3 92 4 5 6 91 7 90 8 89 9 88 10 87 11 86 12 85 13 84 14 83 15 82 16 81 17 18 19 20 80 21 79 22 23 78 24 77 25 76 26 27 28 75 29 30 74 31 73 32 72 33 34 35 71 36 70 37 38 69 39 40 68 41 67 42 43 66 44 65 45 46 64 47 48 49 50 51 52 63 53 62 54 ...

result:

points 0.96666666670

Test #10:

score: 87
Acceptable Answer
time: 2ms
memory: 3888kb

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

result:

points 0.96666666670

Test #11:

score: 89.3333
Acceptable Answer
time: 0ms
memory: 3808kb

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

result:

points 0.99259259260

Test #12:

score: 82
Acceptable Answer
time: 2ms
memory: 3884kb

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

result:

points 0.91111111110