QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#412025#4252. PermutationRafi220 52ms4156kbC++141.8kb2024-05-15 23:16:292024-05-15 23:16:30

Judging History

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

  • [2024-05-15 23:16:30]
  • 评测
  • 测评结果:0
  • 用时:52ms
  • 内存:4156kb
  • [2024-05-15 23:16:29]
  • 提交

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]) 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]) 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]) 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=T1;
    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+1;
        while(true)
        {
            vector<int>DP(n);
            int act=0;
            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-1);
}
/*
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    vector<int>w=construct_permutation(13);
    for(auto x:w) cout<<x<<" ";


    return 0;
}*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 38ms
memory: 3828kb

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

result:

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

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 52ms
memory: 4156kb

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

result:

wrong answer Integer 23 violates the range [0, 22]