QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#866384 | #8812. Library 3 | lgvc# | 21 | 136ms | 3840kb | C++23 | 1.1kb | 2025-01-22 14:51:23 | 2025-01-22 14:51:27 |
Judging History
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};
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;
std::swap(b[i],b[j]);
if((la==N-i-1)||(query(b)<la)) {
tp.push_back(j);
vi[j]=1;
}
std::swap(b[i],b[j]);
}
b=sv(b,tp);
}
answer(b);
}
詳細信息
Subtask #1:
score: 2
Accepted
Test #1:
score: 2
Accepted
time: 1ms
memory: 3712kb
input:
2 0 1
output:
? 0 1 ? 1 0 ! 0 1 -
result:
ok Accepted
Test #2:
score: 2
Accepted
time: 0ms
memory: 3840kb
input:
3 1 0 2
output:
? 2 1 0 ? 1 2 0 ? 0 1 2 ! 1 2 0 -
result:
ok Accepted
Test #3:
score: 2
Accepted
time: 0ms
memory: 3840kb
input:
4 1 0 2 2 1
output:
? 2 1 3 0 ? 1 2 3 0 ? 3 1 2 0 ? 0 1 3 2 ? 1 2 0 3 ! 1 2 3 0 -
result:
ok Accepted
Test #4:
score: 2
Accepted
time: 0ms
memory: 3840kb
input:
5 3 4 2 4 4 1 1 0
output:
? 2 4 3 0 1 ? 4 2 3 0 1 ? 3 4 2 0 1 ? 0 4 3 2 1 ? 1 4 3 0 2 ? 3 0 2 4 1 ? 3 1 2 0 4 ? 3 0 2 1 4 ! 3 0 2 1 4 -
result:
ok Accepted
Test #5:
score: 2
Accepted
time: 0ms
memory: 3840kb
input:
5 2 3 1 3 3 2 0
output:
? 2 4 3 0 1 ? 4 2 3 0 1 ? 3 4 2 0 1 ? 0 4 3 2 1 ? 1 4 3 0 2 ? 3 0 2 4 1 ? 3 1 2 0 4 ! 3 1 2 0 4 -
result:
ok Accepted
Test #6:
score: 2
Accepted
time: 0ms
memory: 3840kb
input:
6 2 3 3 1 1 3 2 1 1 1
output:
? 2 4 5 0 1 3 ? 4 2 5 0 1 3 ? 5 4 2 0 1 3 ? 0 4 5 2 1 3 ? 1 4 5 0 2 3 ? 3 4 5 0 1 2 ? 0 4 5 1 2 3 ? 1 5 4 2 0 3 ? 1 3 5 2 0 4 ? 1 4 3 2 0 5 ! 1 4 5 2 0 3 -
result:
ok Accepted
Test #7:
score: 2
Accepted
time: 0ms
memory: 3712kb
input:
6 3 4 2 2 4 2 1 1 0 1
output:
? 2 4 5 0 1 3 ? 4 2 5 0 1 3 ? 5 4 2 0 1 3 ? 0 4 5 2 1 3 ? 1 4 5 0 2 3 ? 3 4 5 0 1 2 ? 5 4 0 2 1 3 ? 3 4 5 2 1 0 ? 3 4 0 2 1 5 ? 3 1 0 2 4 5 ! 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 1 2 2 0
output:
? 2 4 5 0 1 3 ? 4 2 5 0 1 3 ? 5 4 2 0 1 3 ? 0 4 5 2 1 3 ? 1 4 5 0 2 3 ? 3 4 5 0 1 2 ? 4 1 5 0 2 3 ? 4 1 0 5 2 3 ? 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: 3712kb
input:
5 3 2 4 2 2 1 1 0
output:
? 2 4 3 0 1 ? 4 2 3 0 1 ? 3 4 2 0 1 ? 0 4 3 2 1 ? 1 4 3 0 2 ? 4 0 3 2 1 ? 4 1 3 0 2 ? 4 0 3 1 2 ! 4 0 3 1 2 -
result:
ok Accepted
Test #10:
score: 2
Accepted
time: 0ms
memory: 3840kb
input:
6 3 4 4 4 2 4 3 3 1 0
output:
? 2 4 5 0 1 3 ? 4 2 5 0 1 3 ? 5 4 2 0 1 3 ? 0 4 5 2 1 3 ? 1 4 5 0 2 3 ? 3 4 5 0 1 2 ? 1 5 4 0 2 3 ? 1 0 5 4 2 3 ? 1 3 5 0 2 4 ? 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 4 3 3 3 5 5 3 2 2 2 3 3 0 1
output:
? 6 4 5 0 1 3 2 ? 4 6 5 0 1 3 2 ? 5 4 6 0 1 3 2 ? 0 4 5 6 1 3 2 ? 1 4 5 0 6 3 2 ? 3 4 5 0 1 6 2 ? 2 4 5 0 1 3 6 ? 2 4 6 0 1 3 5 ? 6 2 4 0 1 3 5 ? 6 4 0 2 1 3 5 ? 4 2 6 0 1 3 5 ? 0 4 6 2 1 3 5 ? 2 0 4 6 1 3 5 ? 2 0 4 6 3 1 5 ! 2 0 4 6 1 3 5 -
result:
ok Accepted
Test #12:
score: 19
Accepted
time: 1ms
memory: 3584kb
input:
50 45 44 44 44 44 44 44 46 44 44 44 44 44 44 44 44 46 44 44 44 46 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 46 46 44 44 44 44 44 44 44 44 44 44 43 43 45 45 43 43 45 43 43 45 45 43 43 43 43 43 43 43 45 43 45 43 43 43 43 43 43 45 43 43 45 45 45 43 43 43 43 43 43 43 43 43 43 44 44 44 44 44 44 ...
output:
? 41 34 46 29 12 31 42 7 10 18 35 26 47 24 6 30 19 38 45 8 14 40 49 21 36 27 20 0 25 39 48 3 9 16 4 1 5 32 43 15 28 17 2 44 11 37 22 33 23 13 ? 34 41 46 29 12 31 42 7 10 18 35 26 47 24 6 30 19 38 45 8 14 40 49 21 36 27 20 0 25 39 48 3 9 16 4 1 5 32 43 15 28 17 2 44 11 37 22 33 23 13 ? 46 34 41 29 12...
result:
ok Accepted
Test #13:
score: 19
Accepted
time: 2ms
memory: 3840kb
input:
98 93 92 94 94 94 92 94 94 94 94 94 94 94 94 94 94 94 92 94 94 92 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 92 94 94 94 94 94 94 94 94 92 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 92 94 94 94 94 94 91 ...
output:
? 41 34 91 29 12 31 65 50 10 88 87 85 47 93 52 69 83 38 68 54 14 40 95 72 36 27 76 58 25 51 48 94 9 78 62 60 64 32 43 15 84 17 2 44 90 37 22 33 23 70 7 39 6 18 66 86 77 81 89 0 80 57 4 26 5 92 97 67 45 79 13 71 21 24 63 35 56 61 16 82 1 20 55 96 28 74 30 75 53 59 11 46 42 73 3 49 19 8 ? 34 41 91 29 ...
result:
ok Accepted
Test #14:
score: 19
Accepted
time: 6ms
memory: 3712kb
input:
98 89 90 90 90 88 90 88 90 90 88 90 88 90 90 90 90 90 90 88 90 90 90 90 90 90 90 90 90 90 90 88 88 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 88 90 90 90 90 90 88 90 90 90 88 88 90 90 90 88 90 90 90 90 88 90 90 90 90 90 88 90 90 90 90 90 88 90 90 90 90 90 90 90 87 ...
output:
? 41 34 91 29 12 31 65 50 10 88 87 85 47 93 52 69 83 38 68 54 14 40 95 72 36 27 76 58 25 51 48 94 9 78 62 60 64 32 43 15 84 17 2 44 90 37 22 33 23 70 7 39 6 18 66 86 77 81 89 0 80 57 4 26 5 92 97 67 45 79 13 71 21 24 63 35 56 61 16 82 1 20 55 96 28 74 30 75 53 59 11 46 42 73 3 49 19 8 ? 34 41 91 29 ...
result:
ok Accepted
Test #15:
score: 19
Accepted
time: 3ms
memory: 3840kb
input:
99 93 92 92 94 94 94 92 94 92 92 92 92 94 92 92 92 94 94 92 92 92 92 92 92 92 92 94 94 92 92 94 92 94 92 94 92 92 92 94 94 94 92 94 94 92 92 92 92 92 92 92 94 92 92 92 92 92 94 92 92 92 94 92 94 92 94 94 92 92 94 92 94 92 92 94 92 92 92 92 94 92 92 94 92 94 94 94 94 92 94 94 94 92 94 92 92 92 94 94 ...
output:
? 41 34 91 29 12 31 65 50 10 88 87 85 47 93 52 69 83 38 68 54 14 40 95 72 36 27 76 58 25 51 48 94 9 78 98 60 64 32 43 15 84 17 2 44 90 37 22 33 23 70 7 39 6 18 66 86 77 81 89 0 80 57 4 26 5 92 97 67 45 79 13 71 21 24 63 35 56 61 16 82 1 20 55 96 28 74 30 75 53 59 11 46 42 73 3 49 19 8 62 ? 34 41 91 ...
result:
ok Accepted
Test #16:
score: 19
Accepted
time: 7ms
memory: 3840kb
input:
99 91 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 90 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 92 92 92 92 92 92 92 90 92 92 90 90 92 90 92 92 92 92 92 92 92 92 92 92 90 92 92 92 92 92 92 92 92 92 92 92 92 90 92 92 92 90 92 ...
output:
? 41 34 91 29 12 31 65 50 10 88 87 85 47 93 52 69 83 38 68 54 14 40 95 72 36 27 76 58 25 51 48 94 9 78 98 60 64 32 43 15 84 17 2 44 90 37 22 33 23 70 7 39 6 18 66 86 77 81 89 0 80 57 4 26 5 92 97 67 45 79 13 71 21 24 63 35 56 61 16 82 1 20 55 96 28 74 30 75 53 59 11 46 42 73 3 49 19 8 62 ? 34 41 91 ...
result:
ok Accepted
Test #17:
score: 19
Accepted
time: 6ms
memory: 3840kb
input:
99 93 94 94 94 94 94 94 94 94 92 92 94 94 94 94 94 94 92 94 94 94 94 94 92 92 94 94 94 94 94 92 94 94 94 94 94 92 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 92 94 94 94 92 92 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 92 92 94 94 94 94 92 94 94 94 94 94 94 94 94 94 ...
output:
? 41 34 91 29 12 31 65 50 10 88 87 85 47 93 52 69 83 38 68 54 14 40 95 72 36 27 76 58 25 51 48 94 9 78 98 60 64 32 43 15 84 17 2 44 90 37 22 33 23 70 7 39 6 18 66 86 77 81 89 0 80 57 4 26 5 92 97 67 45 79 13 71 21 24 63 35 56 61 16 82 1 20 55 96 28 74 30 75 53 59 11 46 42 73 3 49 19 8 62 ? 34 41 91 ...
result:
ok Accepted
Test #18:
score: 19
Accepted
time: 5ms
memory: 3840kb
input:
100 96 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 97 97 95 95 97 95 95 97 95 95 95 95 95 97 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 97 95 95 97 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 97...
output:
? 41 34 91 29 12 31 65 50 10 88 87 85 47 93 52 69 83 38 68 54 14 40 95 72 36 27 76 58 25 51 48 94 9 78 98 60 64 99 43 15 84 17 2 44 90 37 22 33 23 70 7 39 6 18 66 86 77 81 89 0 80 57 4 26 5 92 97 67 45 79 13 71 21 24 63 35 56 61 16 82 1 20 55 96 28 74 30 75 53 59 11 46 42 73 3 49 19 8 62 32 ? 34 41 ...
result:
ok Accepted
Test #19:
score: 19
Accepted
time: 2ms
memory: 3840kb
input:
100 96 95 95 97 95 97 95 95 95 97 95 95 95 97 97 95 95 95 95 97 95 95 95 95 95 95 95 95 95 95 97 95 95 97 95 95 95 95 97 95 97 95 95 95 95 97 95 97 95 97 95 95 95 95 95 95 97 97 95 95 95 97 95 97 97 95 95 95 95 95 95 95 95 95 97 95 95 95 95 95 95 95 95 95 97 95 95 97 95 95 95 95 95 97 95 95 97 97 97...
output:
? 41 34 91 29 12 31 65 50 10 88 87 85 47 93 52 69 83 38 68 54 14 40 95 72 36 27 76 58 25 51 48 94 9 78 98 60 64 99 43 15 84 17 2 44 90 37 22 33 23 70 7 39 6 18 66 86 77 81 89 0 80 57 4 26 5 92 97 67 45 79 13 71 21 24 63 35 56 61 16 82 1 20 55 96 28 74 30 75 53 59 11 46 42 73 3 49 19 8 62 32 ? 34 41 ...
result:
ok Accepted
Test #20:
score: 19
Accepted
time: 2ms
memory: 3712kb
input:
100 95 94 96 96 96 96 96 96 96 96 96 96 96 94 94 96 96 96 96 96 94 94 96 94 96 94 96 96 94 94 96 96 94 96 94 96 96 94 96 96 96 96 96 96 96 94 94 94 96 94 96 96 94 94 94 96 96 94 96 96 94 96 94 94 96 94 94 96 96 94 96 94 94 96 96 96 94 96 96 96 96 96 96 94 96 94 96 94 96 94 96 94 96 96 96 96 94 96 96...
output:
? 47 18 11 89 96 60 1 20 35 51 33 16 77 84 36 39 14 48 76 56 46 69 29 25 75 34 80 67 86 53 64 15 5 38 9 28 82 91 55 6 54 43 8 66 79 70 81 71 27 95 65 2 90 97 7 73 83 62 32 10 37 98 72 31 63 23 22 3 61 4 85 59 93 87 44 24 99 52 58 19 41 26 68 45 30 94 40 21 0 17 78 88 49 57 50 12 42 92 74 13 ? 18 47 ...
result:
ok Accepted
Test #21:
score: 19
Accepted
time: 4ms
memory: 3840kb
input:
100 93 94 92 92 92 92 94 94 94 92 92 94 92 92 94 94 92 92 94 94 94 92 94 94 92 94 92 94 92 92 92 94 92 92 94 94 92 92 94 94 92 94 92 92 92 94 92 92 94 92 92 92 94 92 92 94 92 94 94 92 92 94 92 92 92 92 92 92 92 94 92 92 92 92 92 94 92 94 94 92 92 94 94 94 92 94 92 92 92 92 92 94 94 92 92 92 94 92 94...
output:
? 47 18 11 89 96 60 1 20 35 51 33 16 77 84 36 39 14 48 76 56 46 69 29 25 75 34 80 67 86 53 64 15 5 38 9 28 82 91 55 6 54 43 8 66 79 70 81 71 27 95 65 2 90 97 7 73 83 62 32 10 37 98 72 31 63 23 22 3 61 4 85 59 93 87 44 24 99 52 58 19 41 26 68 45 30 94 40 21 0 17 78 88 49 57 50 12 42 92 74 13 ? 18 47 ...
result:
ok Accepted
Test #22:
score: 19
Accepted
time: 4ms
memory: 3712kb
input:
99 89 90 90 90 90 90 90 90 90 90 88 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 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 90 90 90 90 90 90 88 90 90 88 88 90 90 88 90 90 90 90 90 90 90 90 90 90 90 90 90 88 90 90 88 90 ...
output:
? 47 18 11 89 96 60 1 20 35 51 33 16 77 84 36 39 14 48 76 56 46 69 29 25 75 34 80 67 86 53 64 15 5 38 9 28 82 91 55 6 54 43 8 66 79 70 81 71 27 95 65 2 90 97 7 73 83 62 32 10 37 98 72 31 63 23 22 3 61 4 85 59 93 87 44 24 13 52 58 19 41 26 68 45 30 94 40 21 0 17 78 88 49 57 50 12 42 92 74 ? 18 47 11 ...
result:
ok Accepted
Test #23:
score: 19
Accepted
time: 4ms
memory: 3712kb
input:
100 93 94 94 94 94 94 94 94 94 94 94 92 92 94 94 94 94 94 94 94 94 94 94 92 94 92 94 94 94 94 94 94 94 94 92 94 94 92 94 94 92 94 94 94 94 94 94 94 94 92 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 92 94 94 94 94 94 92 94 94 94 94 94 94 94 94 92 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94...
output:
? 47 18 11 89 96 60 1 20 35 51 33 16 77 84 36 39 14 48 76 56 46 69 29 25 75 34 80 67 86 53 64 15 5 38 9 28 82 91 55 6 54 43 8 66 79 70 81 71 27 95 65 2 90 97 7 73 83 62 32 10 37 98 72 31 63 23 22 3 61 4 85 59 93 87 44 24 99 52 58 19 41 26 68 45 30 94 40 21 0 17 78 88 49 57 50 12 42 92 74 13 ? 18 47 ...
result:
ok Accepted
Test #24:
score: 19
Accepted
time: 3ms
memory: 3840kb
input:
100 97 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 96 96 96 96 98 96 96 98 98 96 96 96 96 96 96 96 98 96 96 96 96 96 96 98 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 98 96 96 96 96 96 96 96 96 96 96 96 96 96 96 96 98 96...
output:
? 47 18 11 89 96 60 1 20 35 51 33 16 77 84 36 39 14 48 76 56 46 69 29 25 75 34 80 67 86 53 64 15 5 38 9 28 82 91 55 6 54 43 8 66 79 70 81 71 27 95 65 2 90 97 7 73 83 62 32 10 37 98 72 31 63 23 22 3 61 4 85 59 93 87 44 24 99 52 58 19 41 26 68 45 30 94 40 21 0 17 78 88 49 57 50 12 42 92 74 13 ? 18 47 ...
result:
ok Accepted
Subtask #3:
score: 0
Wrong Answer
Dependency #2:
100%
Accepted
Test #25:
score: 0
Wrong Answer
time: 136ms
memory: 3712kb
input:
498 494 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 495 ...
output:
? 229 340 11 437 375 128 481 234 341 442 33 131 464 420 479 306 233 126 387 330 292 195 29 269 134 34 415 171 296 133 323 202 410 165 359 438 82 182 408 403 424 43 109 66 186 318 264 71 27 300 440 295 90 320 7 236 185 235 104 455 462 166 309 354 453 429 22 3 461 115 85 459 466 434 44 224 494 226 261...
result:
wrong answer Wrong Answer [4]