QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#414358#4252. Permutationjames1BadCreeper0 1ms4032kbC++141.0kb2024-05-18 21:56:012024-05-18 21:56:02

Judging History

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

  • [2024-05-18 21:56:02]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:4032kb
  • [2024-05-18 21:56:01]
  • 提交

answer

#include "perm.h"
#include <bits/stdc++.h>
using namespace std; 
typedef long long i64; 
const int INF = 1e9; 

vector<int> construct_permutation(i64 k) {
    int len = 0; 
    // 1 2 4 8 16 32 64 128 256 512 

    while (k > (1ll << len)) ++len; 
	
	--len; 

    k -= 1 << len; 
    vector<int> a(len + 5, -1), ans, b;
    int mn = -1, se = -1;
    for (int i = len - 1; i >= 0; --i)
        if (k >> i & 1) {
            if (i && (k >> i - 1 & 1) && mn != -1 && se != -1) {
                --a[mn]; 
                a[i - 1] = a[se]; 
                --a[se]; 
                --i; 
            } else if (mn != -1) a[i] = a[mn] - 1, se = mn, mn = i; 
            else a[i] = -INF - 1, mn = i; 
        }
    for (int i = 0; i < len; ++i) {
        if (a[i] != -1) ans.push_back(a[i]); 
        ans.push_back(INF - i); 
    }
    reverse(ans.begin(), ans.end()); b = ans; sort(b.begin(), b.end()); 
    for (int &i : ans) 
        i = lower_bound(b.begin(), b.end(), i) - b.begin(); 
    return ans;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

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

result:

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

Subtask #2:

score: 0
Wrong Answer

Test #2:

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

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

result:

ok 

Test #3:

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

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

result:

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