QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#865172#8812. Library 3Pioneer21 41ms3840kbC++20630b2025-01-21 15:48:292025-01-21 15:48:30

Judging History

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

  • [2025-01-21 15:48:30]
  • 评测
  • 测评结果:21
  • 用时:41ms
  • 内存:3840kb
  • [2025-01-21 15:48:29]
  • 提交

answer

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

#define sz(s) (int)s.size()

using namespace std;

vector<int> get(vector<int> p){
    vector<int> a(sz(p));
    for(int i=0;i<sz(p);i++)a[p[i]]=i;
    return a;
}

void solve(int N) {
    vector<int> p(N,0);
    for(int i=1;i<N;i++)p[i]=i;
    int cur=query(get(p));
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            swap(p[i],p[j]);
            int x=query(get(p));
            if(x<cur){
                cur=x;
            }
            else{
                swap(p[i],p[j]);
            }
        }
    }
    answer(get(p));
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 2
Accepted

Test #1:

score: 2
Accepted
time: 0ms
memory: 3712kb

input:

2
0
1

output:

? 0 1
? 1 0
! 0 1
-

result:

ok Accepted

Test #2:

score: 2
Accepted
time: 1ms
memory: 3712kb

input:

3
2
1
0
1

output:

? 0 1 2
? 1 0 2
? 1 2 0
? 2 1 0
! 1 2 0
-

result:

ok Accepted

Test #3:

score: 2
Accepted
time: 0ms
memory: 3840kb

input:

4
3
2
1
0
1
1
1

output:

? 0 1 2 3
? 1 0 2 3
? 1 2 0 3
? 1 2 3 0
? 2 1 3 0
? 3 2 1 0
? 1 3 2 0
! 1 2 3 0
-

result:

ok Accepted

Test #4:

score: 2
Accepted
time: 1ms
memory: 3840kb

input:

5
2
1
2
2
2
2
0
1
1
1
1

output:

? 0 1 2 3 4
? 1 0 2 3 4
? 1 2 0 3 4
? 1 3 2 0 4
? 1 4 2 3 0
? 2 0 1 3 4
? 3 0 2 1 4
? 3 0 2 4 1
? 2 0 3 1 4
? 3 0 4 1 2
? 4 0 2 1 3
! 3 0 2 1 4
-

result:

ok Accepted

Test #5:

score: 2
Accepted
time: 0ms
memory: 3712kb

input:

5
1
2
2
0
1
1
1
1
1
1
1

output:

? 0 1 2 3 4
? 1 0 2 3 4
? 2 1 0 3 4
? 3 1 2 0 4
? 3 1 2 4 0
? 3 2 1 0 4
? 1 3 2 0 4
? 3 4 2 0 1
? 2 1 3 0 4
? 3 1 4 0 2
? 4 1 2 0 3
! 3 1 2 0 4
-

result:

ok Accepted

Test #6:

score: 2
Accepted
time: 0ms
memory: 3712kb

input:

6
4
3
4
4
2
3
3
3
3
3
1
2
2
2
0
1

output:

? 0 1 2 3 4 5
? 1 0 2 3 4 5
? 1 2 0 3 4 5
? 1 3 2 0 4 5
? 1 4 2 3 0 5
? 1 4 2 3 5 0
? 2 4 1 3 0 5
? 3 4 2 1 0 5
? 4 1 2 3 0 5
? 5 4 2 3 0 1
? 1 4 3 2 0 5
? 1 2 3 4 0 5
? 1 4 3 5 0 2
? 1 3 4 2 0 5
? 1 4 5 2 0 3
? 1 5 4 2 0 3
! 1 4 5 2 0 3
-

result:

ok Accepted

Test #7:

score: 2
Accepted
time: 1ms
memory: 3840kb

input:

6
3
4
2
3
3
3
3
3
1
2
0
1
1
1
1
1

output:

? 0 1 2 3 4 5
? 1 0 2 3 4 5
? 2 1 0 3 4 5
? 2 1 3 0 4 5
? 2 1 4 3 0 5
? 2 1 5 3 4 0
? 1 2 0 3 4 5
? 2 3 0 1 4 5
? 2 4 0 3 1 5
? 2 4 0 3 5 1
? 3 4 0 2 1 5
? 3 2 0 4 1 5
? 3 4 0 5 1 2
? 4 3 0 2 1 5
? 5 4 0 2 1 3
? 3 5 0 2 1 4
! 3 4 0 2 1 5
-

result:

ok Accepted

Test #8:

score: 2
Accepted
time: 0ms
memory: 3712kb

input:

6
3
4
2
3
3
1
2
2
2
2
2
0
1
1
1
1

output:

? 0 1 2 3 4 5
? 1 0 2 3 4 5
? 2 1 0 3 4 5
? 2 1 3 0 4 5
? 2 1 4 3 0 5
? 2 1 5 3 4 0
? 1 2 5 3 4 0
? 2 3 5 1 4 0
? 2 4 5 3 1 0
? 2 5 1 3 4 0
? 3 1 5 2 4 0
? 4 1 5 3 2 0
? 4 1 2 3 5 0
? 3 1 5 4 2 0
? 4 1 3 5 2 0
? 5 1 4 3 2 0
! 4 1 5 3 2 0
-

result:

ok Accepted

Test #9:

score: 2
Accepted
time: 0ms
memory: 3712kb

input:

5
4
3
4
4
4
2
1
2
2
0
1

output:

? 0 1 2 3 4
? 1 0 2 3 4
? 1 2 0 3 4
? 1 3 2 0 4
? 1 4 2 3 0
? 2 0 1 3 4
? 2 0 3 1 4
? 2 0 3 4 1
? 3 0 2 1 4
? 4 0 3 1 2
? 3 0 4 1 2
! 4 0 3 1 2
-

result:

ok Accepted

Test #10:

score: 2
Accepted
time: 1ms
memory: 3840kb

input:

6
5
4
3
4
4
4
4
4
4
4
2
1
2
2
2
0

output:

? 0 1 2 3 4 5
? 1 0 2 3 4 5
? 1 2 0 3 4 5
? 1 2 3 0 4 5
? 1 2 4 3 0 5
? 1 2 5 3 4 0
? 2 1 0 3 4 5
? 3 2 0 1 4 5
? 4 2 0 3 1 5
? 5 2 0 3 4 1
? 1 3 0 2 4 5
? 1 3 0 4 2 5
? 1 3 0 4 5 2
? 1 4 0 3 2 5
? 1 5 0 4 2 3
? 1 3 0 5 2 4
! 1 3 0 5 2 4
-

result:

ok Accepted

Subtask #2:

score: 19
Accepted

Dependency #1:

100%
Accepted

Test #11:

score: 19
Accepted
time: 1ms
memory: 3840kb

input:

7
5
4
5
5
5
5
5
3
4
2
3
3
3
3
3
3
3
1
2
2
2
0

output:

? 0 1 2 3 4 5 6
? 1 0 2 3 4 5 6
? 1 2 0 3 4 5 6
? 1 3 2 0 4 5 6
? 1 4 2 3 0 5 6
? 1 5 2 3 4 0 6
? 1 6 2 3 4 5 0
? 2 0 1 3 4 5 6
? 2 0 3 1 4 5 6
? 2 0 4 3 1 5 6
? 2 0 4 3 5 1 6
? 2 0 4 3 6 5 1
? 3 0 4 2 1 5 6
? 4 0 2 3 1 5 6
? 5 0 4 3 1 2 6
? 6 0 4 3 1 5 2
? 2 0 3 4 1 5 6
? 2 0 4 5 1 3 6
? 2 0 4 5 1 ...

result:

ok Accepted

Test #12:

score: 19
Accepted
time: 4ms
memory: 3712kb

input:

50
49
48
47
48
46
47
47
47
47
47
47
45
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
44
45
43
44
44
44
44
44
42
43
43
43
43
43
43
43
43
43
43
43
43
43
43
43
43
43
41
42
42
40
41
41
41
41
41
41
41
41
41
41
41
39
40
40
40
40
40
40
40
40
40
40
40
40
40
40
40
40
40
40
38
...

output:

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

result:

ok Accepted

Test #13:

score: 19
Accepted
time: 27ms
memory: 3840kb

input:

98
91
92
92
92
90
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
...

output:

? 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 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 91 92 93 94 95 96 97
? 1 0 2 3 4 5 ...

result:

ok Accepted

Test #14:

score: 19
Accepted
time: 22ms
memory: 3712kb

input:

98
97
96
97
97
97
97
95
96
96
96
94
93
94
94
94
94
92
93
91
92
92
90
89
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
88
89
89
87
88
88
86
...

output:

? 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 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 91 92 93 94 95 96 97
? 1 0 2 3 4 5 ...

result:

ok Accepted

Test #15:

score: 19
Accepted
time: 37ms
memory: 3712kb

input:

99
90
91
89
90
90
90
90
90
90
90
88
89
87
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
86
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
85
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
84
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
...

output:

? 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 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 91 92 93 94 95 96 97 98
? 1 0 2 3 4...

result:

ok Accepted

Test #16:

score: 19
Accepted
time: 41ms
memory: 3712kb

input:

99
94
95
95
95
95
95
95
95
93
94
94
94
92
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
91
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
90
91
91
91
91
91
91
91
91
91
91
91
91
91
...

output:

? 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 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 91 92 93 94 95 96 97 98
? 1 0 2 3 4...

result:

ok Accepted

Test #17:

score: 19
Accepted
time: 18ms
memory: 3584kb

input:

99
96
97
95
96
96
96
94
93
94
94
94
94
92
93
93
93
93
93
91
92
92
92
92
92
90
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
...

output:

? 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 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 91 92 93 94 95 96 97 98
? 1 0 2 3 4...

result:

ok Accepted

Test #18:

score: 19
Accepted
time: 35ms
memory: 3712kb

input:

100
94
93
92
93
93
93
93
93
93
93
93
93
93
93
93
93
93
93
91
92
92
92
92
92
92
92
92
92
92
92
92
90
91
91
91
91
91
91
91
91
91
91
89
90
90
90
90
90
90
90
90
90
88
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
87
88
88
88
88
88
88
88
88
88...

output:

? 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 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 91 92 93 94 95 96 97 98 99
? 1 0 2 ...

result:

ok Accepted

Test #19:

score: 19
Accepted
time: 35ms
memory: 3712kb

input:

100
96
95
96
96
94
95
95
95
95
95
95
95
93
94
94
94
94
94
92
93
93
93
93
93
93
93
91
90
91
91
91
91
89
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90...

output:

? 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 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 91 92 93 94 95 96 97 98 99
? 1 0 2 ...

result:

ok Accepted

Test #20:

score: 19
Accepted
time: 26ms
memory: 3840kb

input:

100
95
94
95
95
95
95
93
94
94
94
94
94
94
94
94
92
93
93
91
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
92
90
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91
91...

output:

? 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 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 91 92 93 94 95 96 97 98 99
? 1 0 2 ...

result:

ok Accepted

Test #21:

score: 19
Accepted
time: 30ms
memory: 3840kb

input:

100
91
92
92
92
90
91
91
89
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
88
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89
89...

output:

? 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 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 91 92 93 94 95 96 97 98 99
? 1 0 2 ...

result:

ok Accepted

Test #22:

score: 19
Accepted
time: 26ms
memory: 3840kb

input:

99
98
97
98
98
98
96
97
97
97
97
97
95
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
94
95
95
95
95
95
95
95
95
95
95
93
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
...

output:

? 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 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 91 92 93 94 95 96 97 98
? 1 0 2 3 4...

result:

ok Accepted

Test #23:

score: 19
Accepted
time: 36ms
memory: 3712kb

input:

100
99
98
99
99
99
99
99
99
99
99
97
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
96
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97...

output:

? 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 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 91 92 93 94 95 96 97 98 99
? 1 0 2 ...

result:

ok Accepted

Test #24:

score: 19
Accepted
time: 31ms
memory: 3840kb

input:

100
99
98
99
99
97
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
98
96
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97
97...

output:

? 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 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 91 92 93 94 95 96 97 98 99
? 1 0 2 ...

result:

ok Accepted

Subtask #3:

score: 0
Time Limit Exceeded

Dependency #2:

100%
Accepted

Test #25:

score: 0
Time Limit Exceeded

input:

498
493
492
491
490
491
491
489
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
490
...

output:

? 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 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 91 92 93 94 95 96 97 98 99 100 101 ...

result: