QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#866492#8812. Library 3lgvc#21 131ms3840kbC++231.2kb2025-01-22 15:46:292025-01-22 15:46:30

Judging History

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

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

answer

#include "library3.h"
#include <bits/stdc++.h>
std::mt19937 rng(time(0));
int la;
std::vector<int> sv(std::vector<int> b,std::vector<int> tp) {
	if(tp.size()<=1) return b;
	for(int j=0;j<tp.size();j++) {
		std::swap(tp[j],tp[rng()%(j+1)]);
	}
	std::swap(b[tp[0]],b[tp[1]]);
	la--;
	std::vector<int> t0,t1;
	t0.push_back(tp[0]);
	t1.push_back(tp[1]);
	for(int j=2;j<tp.size();j++) {
		std::swap(b[tp[0]],b[tp[j]]);
		if(query(b)<=la) {
			t0.push_back(tp[j]);
		} else {			
			t1.push_back(tp[j]);
		}
		std::swap(b[tp[0]],b[tp[j]]);
	}
	b=sv(b,t0);
	b=sv(b,t1);
	return b;
}
void solve(int N) {
	std::vector<int> b;
	b.resize(N);
	for(int i=0;i<N;i++) {
		b[i]=i;
	}
	for(int i=0;i<N;i++) {		
		std::swap(b[i],b[rng()%(i+1)]);
	}
	la=query(b);
	bool vi[509]={0};
	int ct=N;
	for(int i=0;i<N;i++) {
		if(vi[i]) continue;
		std::vector<int> tp;
		tp.push_back(i);
		for(int j=i+1;j<N;j++) {
			if(vi[j]) continue;
			if(la==ct-1) {
				tp.push_back(j);
				vi[j]=1;
				continue;
			} 
			std::swap(b[i],b[j]);
			if(query(b)<la) {
				tp.push_back(j);
				vi[j]=1;
				std::swap(b[i],b[j]);
				continue;
			} 
			std::swap(b[i],b[j]);
		}
		ct-=tp.size();
		b=sv(b,tp);
	}
	answer(b);
}

詳細信息

Subtask #1:

score: 2
Accepted

Test #1:

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

input:

2
1

output:

? 1 0
! 0 1
-

result:

ok Accepted

Test #2:

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

input:

3
0
1
1
1

output:

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

result:

ok Accepted

Test #3:

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

input:

4
1
2
2
2
2
2

output:

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

result:

ok Accepted

Test #4:

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

input:

5
2
3
3
1
3
0
2

output:

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

result:

ok Accepted

Test #5:

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

input:

5
3
2
2
2
4
3
3
0

output:

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

result:

ok Accepted

Test #6:

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

input:

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

output:

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

result:

ok Accepted

Test #7:

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

input:

6
3
2
4
2
2
4
3
3
2
1

output:

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

result:

ok Accepted

Test #8:

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

input:

6
3
2
4
4
2
4
3
2
0

output:

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

result:

ok Accepted

Test #9:

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

input:

5
4
2
2
4
1

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

? 1 2 0 3 4 5
? 2 1 0 3 4 5
? 0 2 1 3 4 5
? 3 2 0 1 4 5
? 4 2 0 3 1 5
? 5 2 0 3 4 1
? 1 0 2 3 4 5
? 1 3 0 2 4 5
? 1 4 0 3 2 5
? 1 5 0 3 4 2
? 1 5 0 3 2 4
? 1 5 0 2 4 3
! 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: 3712kb

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

50
45
46
44
44
46
44
46
44
46
46
46
44
46
46
44
46
46
46
46
46
46
44
46
46
44
46
46
46
46
46
44
46
44
44
46
46
46
46
46
46
46
46
46
46
44
46
46
46
46
46
43
43
43
43
45
43
43
43
45
45
43
44
44
44
44
44
42
44
40
40
42
42
42
39
37
39
36
36
35
34
34
34
34
32
32
34
34
34
34
34
34
34
34
32
32
34
34
34
34
...

output:

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

result:

ok Accepted

Test #13:

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

input:

98
89
90
90
90
90
90
90
90
90
90
90
88
90
90
90
90
90
90
90
90
90
90
90
90
90
88
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
88
90
90
90
90
88
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
90
90
90
90
90
90
90
90
90
90
88
90
90
90
90
90
90
87
...

output:

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

result:

ok Accepted

Test #14:

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

input:

98
89
90
88
88
88
88
88
90
88
88
90
88
90
88
88
88
90
90
90
88
88
88
88
90
88
90
90
88
88
90
88
90
88
90
90
90
90
88
90
88
88
88
88
88
90
90
90
90
88
90
90
90
88
90
88
88
88
90
88
90
88
88
90
88
88
90
88
90
90
88
88
88
88
88
88
90
90
88
90
88
88
88
90
90
90
88
90
88
88
88
88
90
90
88
88
90
88
88
89
...

output:

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

result:

ok Accepted

Test #15:

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

input:

99
93
94
94
94
94
94
94
92
94
94
94
94
94
94
92
94
94
94
92
94
92
92
94
94
94
92
94
94
94
94
94
94
94
92
94
94
94
94
94
94
92
92
92
94
92
92
92
92
92
92
94
94
94
94
94
94
94
94
94
94
94
94
94
94
92
94
94
92
92
92
94
94
92
92
94
94
94
94
92
94
92
94
94
94
94
94
94
94
94
94
94
94
92
94
92
94
92
92
92
...

output:

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

result:

ok Accepted

Test #16:

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

input:

99
93
94
94
94
94
94
92
94
92
94
94
92
94
94
94
92
94
94
92
92
94
92
92
94
94
94
92
92
92
94
94
94
94
94
94
92
94
94
94
94
92
94
94
94
94
94
94
94
92
94
94
94
94
94
92
94
94
94
94
94
94
92
94
94
94
94
94
92
92
94
94
92
94
94
94
94
92
94
94
94
94
94
94
92
94
94
94
94
92
92
94
94
94
94
94
94
94
94
94
...

output:

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

result:

ok Accepted

Test #17:

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

input:

99
95
94
94
96
94
96
94
94
94
94
94
94
94
94
94
94
94
96
94
94
94
94
94
94
96
94
94
96
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
96
94
94
94
96
94
94
94
96
94
94
94
94
96
94
94
94
94
94
94
94
94
94
94
94
94
96
94
94
94
94
94
96
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
96
94
94
...

output:

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

result:

ok Accepted

Test #18:

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

input:

100
96
95
95
95
95
97
95
97
95
95
97
95
95
95
95
95
95
97
95
95
95
95
97
95
97
95
97
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
97
95
95
95
95
97
95
95
95
97
95
95
95
95
95
95
95
95
95
95
95
95
95
97
95
95
97
95
95
97
95
95
95
95
95
95
95
95
95
95
95
97
95
95
97
95
97
95
95
95
95...

output:

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

result:

ok Accepted

Test #19:

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

input:

100
96
97
95
95
97
97
95
97
95
97
97
95
95
95
95
97
97
95
95
97
97
97
95
97
97
95
97
97
95
97
95
97
95
97
97
97
95
95
97
95
97
97
97
97
97
95
97
95
95
97
95
97
95
95
95
95
97
95
95
97
97
95
95
97
95
95
95
95
95
97
97
95
95
97
95
97
97
95
97
95
97
95
97
97
97
97
97
97
97
95
97
95
97
97
97
97
97
95
97...

output:

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

result:

ok Accepted

Test #20:

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

input:

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

output:

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

result:

ok Accepted

Test #21:

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

input:

100
91
90
90
92
92
92
92
92
92
90
92
92
92
92
90
92
92
92
92
92
92
90
92
92
92
92
92
92
92
90
90
92
92
90
92
90
92
92
92
90
92
92
92
90
92
92
92
90
90
92
92
92
92
92
92
90
92
92
90
92
90
90
92
92
92
92
92
92
92
92
92
92
92
90
92
92
92
92
92
92
90
92
90
92
92
92
92
90
92
92
92
92
90
92
90
92
92
92
90...

output:

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

result:

ok Accepted

Test #22:

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

input:

99
95
94
96
94
96
94
96
96
94
94
94
94
96
94
96
94
96
96
96
96
94
96
94
96
94
94
94
96
94
94
94
94
94
94
96
94
96
94
94
96
96
96
96
94
96
94
94
94
94
96
94
96
94
96
96
94
96
94
94
96
94
94
94
94
96
94
96
94
96
96
94
96
96
96
94
94
94
94
94
94
94
94
94
94
96
96
94
94
94
94
96
96
94
94
96
96
94
94
96
...

output:

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

result:

ok Accepted

Test #23:

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

input:

100
95
94
94
94
94
94
94
94
94
94
94
96
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
94
96
94
96
94
94
94
94
94
94
94
96
94
94
94
94
94
94
94
94
94
94
94
94
96
94
94
94
94
94
94
94
94
94
94
94
94
96
94
94
94
94
94
94
94
94
94
94
94
94
96
94
94
94
94
94
94
94
94
96
94
94
94
94
96...

output:

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

result:

ok Accepted

Test #24:

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

input:

100
89
88
90
90
88
90
90
88
88
90
90
90
90
90
88
90
88
90
90
90
90
88
88
90
90
88
90
90
88
90
90
90
90
90
88
90
90
90
88
90
90
88
90
88
90
88
90
90
90
90
90
88
90
88
90
90
90
88
90
90
88
88
90
88
90
88
90
90
88
90
90
88
90
88
88
88
90
90
90
88
88
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
88
90
90...

output:

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

result:

ok Accepted

Subtask #3:

score: 0
Wrong Answer

Dependency #2:

100%
Accepted

Test #25:

score: 79
Accepted
time: 110ms
memory: 3584kb

input:

498
488
489
489
489
487
489
489
489
489
489
489
489
489
489
489
489
489
489
489
487
489
489
487
489
489
489
489
487
489
489
489
487
489
489
489
489
489
489
489
487
489
489
489
489
489
489
489
489
487
489
489
489
487
489
489
489
489
489
489
489
489
487
489
489
489
489
489
489
487
489
489
487
489
489
...

output:

? 94 119 260 441 480 41 63 471 114 464 301 80 103 353 196 101 1 411 338 108 4 483 440 21 65 330 161 368 154 294 322 299 48 318 208 133 378 237 167 327 386 45 18 445 332 214 476 325 144 452 136 138 264 306 216 189 235 0 492 381 13 241 261 150 109 311 30 418 229 225 433 53 107 195 385 38 400 249 46 12...

result:

ok Accepted

Test #26:

score: 0
Wrong Answer
time: 131ms
memory: 3840kb

input:

498
491
490
492
490
490
490
490
490
490
490
490
490
490
490
492
490
490
490
492
490
490
490
492
490
490
490
490
490
490
490
490
490
490
492
490
490
490
490
492
490
490
490
490
490
490
492
490
490
490
492
490
490
490
490
490
490
490
490
490
490
490
490
492
490
490
490
490
490
490
490
490
490
490
490
...

output:

? 241 116 297 90 171 285 307 46 403 166 117 93 306 253 334 108 352 410 21 81 442 371 182 312 57 346 110 105 26 397 192 275 389 266 324 295 59 157 311 66 386 345 141 118 299 293 201 168 361 175 114 414 19 356 380 444 464 181 127 170 347 463 415 153 239 137 495 436 264 440 308 240 358 56 70 229 103 28...

result:

wrong answer Wrong Answer [4]