QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#412061#4252. PermutationRafi2289.323077 44ms4208kbC++142.0kb2024-05-16 01:56:072024-05-16 01:56:07

Judging History

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

  • [2024-05-16 01:56:07]
  • 评测
  • 测评结果:89.323077
  • 用时:44ms
  • 内存:4208kb
  • [2024-05-16 01:56:07]
  • 提交

answer

#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
int inf=1000000007;
ll infl=1000000000000000007;
int mod=998244353;

bool is[1007];
vector<int>W[1007];

vector<int>calc(ll m)
{
    if(m<=45) return W[m];
   /* vector<int>t1=calc(m/2),T1;
    for(auto x:W[m%2+1]) T1.pb(x+sz(t1)+sz(W[2]));
    for(auto x:W[2]) T1.pb(x);
    for(auto x:t1) T1.pb(x+sz(W[2]));
    vector<int>t2=calc(m/5),T2;
    for(auto x:W[m%5+1]) T2.pb(x+sz(t2)+sz(W[5]));
    for(auto x:W[5]) T2.pb(x);
    for(auto x:t2) T2.pb(x+sz(W[5]));*/
    vector<int>t3=calc(m/11),T3;
    for(auto x:W[m%11+1]) T3.pb(x+sz(t3)+sz(W[11]));
    for(auto x:W[11]) T3.pb(x);
    for(auto x:t3) T3.pb(x+sz(W[11]));

    vector<int> res=T3;
   // if(sz(T2)<sz(res)) res=T2;
   // if(sz(T3)<sz(res)) res=T3;
    return res;
}

vector<int>construct_permutation(ll m)
{
    for(int n=1;n<=7;n++)
    {
        vector<int>p(n);
        for(int i=0;i<n;i++) p[i]=i;
        while(true)
        {
            vector<int>DP(n);
            int act=1;
            for(int i=0;i<n;i++)
            {
                DP[i]=1;
                for(int j=0; j<i; j++) if(p[j]<p[i]) DP[i]+=DP[j];
                act+=DP[i];
            }
            if(!is[act])
            {
                is[act]=1;
                W[act]=p;
            }
            if(!next_permutation(all(p))) break;
        }
    }
    return calc(m);
}

int cnt(vector<int>p)
{
    int n=sz(p);
    vector<int>DP(n);
    int act=1;
    for(int i=0;i<n;i++)
    {
        DP[i]=1;
        for(int j=0; j<i; j++) if(p[j]<p[i]) DP[i]+=DP[j];
        act+=DP[i];
    }
    return act;
}

/*
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    vector<int>w=construct_permutation(123456);
    for(auto x:w) cout<<x<<" ";
    cout<<endl<<cnt(w);

    return 0;
}*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 38ms
memory: 4120kb

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

result:

ok 

Subtask #2:

score: 79.3231
Acceptable Answer

Test #2:

score: 90
Accepted
time: 43ms
memory: 4152kb

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

result:

ok 

Test #3:

score: 90
Accepted
time: 42ms
memory: 4160kb

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

result:

ok 

Test #4:

score: 79.8923
Acceptable Answer
time: 38ms
memory: 3900kb

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
122
119 121 120 1 3 4 2 0 115 117 118 116 6 8 9 7 5 113 114 11 13 14 12 10 109 111 112 110 108 16 18 19 17 15 107 21 23 24 22 20 104 106 105 26 28 29 27 25 101 103 102 100 31 33 34 32 30 97 99 98 36 38 39 37 35 96 41 43 44 42 40 93 95 94 46 48 49 47 45 90 89 9...

result:

points 0.88769230770

Test #5:

score: 88
Acceptable Answer
time: 43ms
memory: 3888kb

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

result:

points 0.97777777780

Test #6:

score: 79.9846
Acceptable Answer
time: 43ms
memory: 3980kb

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

result:

points 0.88871794870

Test #7:

score: 79.6615
Acceptable Answer
time: 39ms
memory: 4208kb

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
110
106 108 109 107 1 3 4 2 0 104 105 6 8 9 7 5 100 102 103 101 11 13 14 12 10 98 99 16 18 19 17 15 95 96 97 21 23 24 22 20 26 28 29 27 25 91 93 94 92 31 33 34 32 30 36 38 39 37 35 87 89 90 88 86 41 43 44 42 40 46 48 49 47 45 85 84 51 53 54 52 50 82 83 81 56 5...

result:

points 0.88512820510

Test #8:

score: 79.9231
Acceptable Answer
time: 43ms
memory: 3852kb

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
123
120 122 121 119 1 3 4 2 0 115 117 118 116 6 8 9 7 5 113 114 11 13 14 12 10 109 111 112 110 108 16 18 19 17 15 107 21 23 24 22 20 104 106 105 26 28 29 27 25 101 103 102 100 31 33 34 32 30 97 99 98 36 38 39 37 35 96 41 43 44 42 40 93 95 94 46 48 49 47 45 90 ...

result:

points 0.8880341880

Test #9:

score: 79.7385
Acceptable Answer
time: 44ms
memory: 3880kb

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
132
131 1 3 4 2 0 128 130 129 127 6 8 9 7 5 124 125 126 11 13 14 12 10 16 18 19 17 15 121 123 122 120 21 23 24 22 20 117 116 119 118 26 28 29 27 25 31 33 34 32 30 115 36 38 39 37 35 113 114 112 41 43 44 42 40 108 110 111 109 107 46 48 49 47 45 103 105 106 104 ...

result:

points 0.8859829060

Test #10:

score: 79.6462
Acceptable Answer
time: 43ms
memory: 3928kb

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
137
135 136 1 3 4 2 0 132 133 134 6 8 9 7 5 129 128 131 130 11 13 14 12 10 126 127 125 16 18 19 17 15 122 123 124 21 23 24 22 20 118 120 121 119 117 26 28 29 27 25 113 115 116 114 31 33 34 32 30 110 112 111 109 36 38 39 37 35 108 41 43 44 42 40 107 106 46 48 4...

result:

points 0.8849572650

Test #11:

score: 79.7077
Acceptable Answer
time: 39ms
memory: 3940kb

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
114
1 3 4 2 0 110 112 113 111 109 6 8 9 7 5 107 108 106 11 13 14 12 10 105 16 18 19 17 15 102 103 104 21 23 24 22 20 101 26 28 29 27 25 99 100 31 33 34 32 30 95 97 98 96 36 38 39 37 35 91 93 94 92 90 41 43 44 42 40 46 48 49 47 45 87 86 89 88 51 53 54 52 50 82 ...

result:

points 0.88564102560

Test #12:

score: 79.3231
Acceptable Answer
time: 43ms
memory: 3988kb

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
127
124 123 126 125 1 3 4 2 0 6 8 9 7 5 120 122 121 11 13 14 12 10 16 18 19 17 15 116 118 119 117 21 23 24 22 20 115 114 26 28 29 27 25 111 112 113 31 33 34 32 30 107 109 110 108 36 38 39 37 35 41 43 44 42 40 103 105 106 104 46 48 49 47 45 100 102 101 99 51 53...

result:

points 0.88136752140