QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#866507 | #8812. Library 3 | lgvc# | 21 | 210ms | 3968kb | C++23 | 1.3kb | 2025-01-22 15:51:25 | 2025-01-22 15:51:25 |
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,b2;
b.resize(N);b2.resize(N);
for(int i=0;i<N;i++) {
b[i]=i;b2[i]=i;
}
for(int i=0;i<N;i++) {
std::swap(b[i],b[rng()%(i+1)]);
std::swap(b2[i],b2[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(b2[i]);
for(int j=i+1;j<N;j++) {
if(vi[j]) continue;
if(la==ct-1) {
tp.push_back(b2[j]);
vi[j]=1;
continue;
}
std::swap(b[b2[i]],b[b2[j]]);
if(query(b)<la) {
tp.push_back(b2[j]);
vi[j]=1;
std::swap(b[b2[i]],b[b2[j]]);
continue;
}
std::swap(b[b2[i]],b[b2[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 0 1
output:
? 0 1 ? 1 0 ! 0 1 -
result:
ok Accepted
Test #2:
score: 2
Accepted
time: 1ms
memory: 3712kb
input:
3 2 0
output:
? 0 1 2 ? 1 2 0 ! 1 2 0 -
result:
ok Accepted
Test #3:
score: 2
Accepted
time: 1ms
memory: 3712kb
input:
4 2 3 3 1
output:
? 0 3 2 1 ? 0 1 2 3 ? 0 3 1 2 ? 1 3 2 0 ! 1 2 3 0 -
result:
ok Accepted
Test #4:
score: 2
Accepted
time: 0ms
memory: 3840kb
input:
5 2 3 3 3 3 3 1 1 2
output:
? 0 4 2 1 3 ? 0 4 2 3 1 ? 0 4 1 2 3 ? 1 4 2 0 3 ? 0 1 2 4 3 ? 0 4 3 1 2 ? 3 4 2 1 0 ? 0 3 2 1 4 ? 4 3 2 1 0 ! 3 0 2 1 4 -
result:
ok Accepted
Test #5:
score: 2
Accepted
time: 0ms
memory: 3840kb
input:
5 3 2 4 2 2 3 3 2
output:
? 0 4 2 1 3 ? 0 4 2 3 1 ? 0 4 1 2 3 ? 1 4 2 0 3 ? 0 1 2 4 3 ? 1 4 2 3 0 ? 1 0 2 4 3 ? 4 3 2 0 1 ! 3 1 2 0 4 -
result:
ok Accepted
Test #6:
score: 2
Accepted
time: 0ms
memory: 3840kb
input:
6 3 4 2 4 4 4 1 3 1 2
output:
? 0 4 2 5 3 1 ? 0 4 2 3 5 1 ? 0 4 5 2 3 1 ? 5 4 2 0 3 1 ? 0 5 2 4 3 1 ? 0 4 2 1 3 5 ? 3 4 5 2 0 1 ? 0 3 5 2 4 1 ? 0 4 5 2 1 3 ? 3 4 5 2 1 0 ! 1 4 5 2 0 3 -
result:
ok Accepted
Test #7:
score: 2
Accepted
time: 1ms
memory: 3840kb
input:
6 4 3 3 3 5 3 4 4 4 1 1 0
output:
? 0 4 2 5 3 1 ? 0 4 2 3 5 1 ? 0 4 5 2 3 1 ? 5 4 2 0 3 1 ? 0 5 2 4 3 1 ? 0 4 2 1 3 5 ? 1 4 2 5 0 3 ? 5 4 2 3 0 1 ? 2 4 3 5 0 1 ? 3 4 2 0 1 5 ? 3 4 0 5 1 2 ? 3 4 0 2 1 5 ! 3 4 0 2 1 5 -
result:
ok Accepted
Test #8:
score: 2
Accepted
time: 0ms
memory: 3840kb
input:
6 4 3 3 5 5 5 4 0
output:
? 0 4 2 5 3 1 ? 0 4 2 3 5 1 ? 0 4 5 2 3 1 ? 5 4 2 0 3 1 ? 0 5 2 4 3 1 ? 0 4 2 1 3 5 ? 0 4 3 2 5 1 ? 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 2 3 3 3 3 1 3 3
output:
? 0 4 2 1 3 ? 0 4 2 3 1 ? 0 4 1 2 3 ? 1 4 2 0 3 ? 0 1 2 4 3 ? 0 4 3 1 2 ? 3 4 2 1 0 ? 0 3 2 1 4 ! 4 0 3 1 2 -
result:
ok Accepted
Test #10:
score: 2
Accepted
time: 0ms
memory: 3840kb
input:
6 4 5 5 5 5 5 4 2 4 2
output:
? 0 4 2 5 3 1 ? 0 4 2 3 5 1 ? 0 4 5 2 3 1 ? 5 4 2 0 3 1 ? 0 5 2 4 3 1 ? 0 4 2 1 3 5 ? 0 1 4 5 3 2 ? 0 3 4 5 2 1 ? 2 0 4 5 3 1 ? 4 3 1 5 2 0 ! 1 3 0 5 2 4 -
result:
ok Accepted
Subtask #2:
score: 19
Accepted
Dependency #1:
100%
Accepted
Test #11:
score: 19
Accepted
time: 0ms
memory: 3840kb
input:
7 5 4 6 4 6 4 6 5 5 2 2
output:
? 0 4 2 5 3 6 1 ? 0 4 2 3 5 6 1 ? 0 4 5 2 3 6 1 ? 0 4 2 1 3 6 5 ? 0 5 2 4 3 6 1 ? 0 4 2 6 3 5 1 ? 5 4 2 0 3 6 1 ? 0 4 2 5 6 1 3 ? 0 4 2 1 5 6 3 ? 0 4 2 6 1 3 5 ? 4 2 0 6 1 3 5 ! 2 0 4 6 1 3 5 -
result:
ok Accepted
Test #12:
score: 19
Accepted
time: 1ms
memory: 3840kb
input:
50 45 44 44 44 44 46 44 46 44 44 44 44 44 44 46 44 44 46 44 44 44 44 44 44 44 46 46 46 44 44 46 44 44 44 46 44 44 44 46 44 44 44 44 46 44 44 44 44 44 46 43 43 43 43 43 43 43 43 43 43 43 43 45 45 43 43 45 43 45 43 43 43 43 45 43 45 43 43 43 43 45 43 43 43 43 43 42 42 44 44 42 42 44 44 44 42 42 42 42 ...
output:
? 10 39 2 28 13 16 36 37 34 49 35 45 40 44 15 18 26 17 0 19 43 21 41 38 3 30 42 32 5 31 9 48 8 1 22 46 20 47 14 11 6 24 7 25 27 29 23 12 4 33 ? 10 39 2 28 13 16 36 37 34 46 35 45 40 44 15 18 26 17 0 19 43 21 41 38 3 30 42 32 5 31 9 48 8 1 22 49 20 47 14 11 6 24 7 25 27 29 23 12 4 33 ? 10 39 2 28 13 ...
result:
ok Accepted
Test #13:
score: 19
Accepted
time: 2ms
memory: 3712kb
input:
98 93 92 92 94 94 92 94 92 94 92 94 92 94 92 94 94 92 94 94 94 92 92 94 92 94 92 92 94 94 92 92 92 92 92 94 92 92 94 94 92 92 94 92 92 92 92 92 92 94 94 92 92 92 92 94 94 94 92 94 92 94 92 92 92 94 92 92 92 92 94 92 92 94 94 94 94 92 94 92 94 92 92 92 92 94 94 92 92 92 92 92 94 94 94 92 92 94 94 93 ...
output:
? 10 82 80 28 13 16 84 81 73 49 85 45 40 44 52 95 89 17 0 87 43 21 41 38 3 30 42 32 5 53 70 55 8 54 96 90 69 50 66 11 68 58 78 75 51 29 23 67 4 33 86 61 15 71 92 64 46 27 24 19 20 57 47 65 48 72 63 12 93 60 9 31 14 34 7 25 83 79 74 97 2 37 39 77 91 35 62 59 56 26 88 94 1 6 36 18 76 22 ? 10 82 80 28 ...
result:
ok Accepted
Test #14:
score: 19
Accepted
time: 3ms
memory: 3840kb
input:
98 93 92 92 92 92 92 94 94 94 92 92 92 92 94 92 92 92 92 92 92 94 92 92 92 92 92 94 94 92 92 94 94 92 92 92 92 94 92 94 94 92 94 92 92 94 94 94 92 94 92 92 92 94 92 94 92 94 92 92 94 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 94 92 94 92 92 92 94 92 92 92 92 94 92 92 92 92 92 92 94 92 92 94 92 91 ...
output:
? 10 82 80 28 13 16 84 81 73 49 85 45 40 44 52 95 89 17 0 87 43 21 41 38 3 30 42 32 5 53 70 55 8 54 96 90 69 50 66 11 68 58 78 75 51 29 23 67 4 33 86 61 15 71 92 64 46 27 24 19 20 57 47 65 48 72 63 12 93 60 9 31 14 34 7 25 83 79 74 97 2 37 39 77 91 35 62 59 56 26 88 94 1 6 36 18 76 22 ? 10 82 80 28 ...
result:
ok Accepted
Test #15:
score: 19
Accepted
time: 6ms
memory: 3712kb
input:
99 91 92 92 92 92 92 92 92 92 92 92 90 90 92 90 92 92 92 92 92 92 92 92 90 92 92 92 92 92 92 92 92 90 90 92 92 92 92 90 92 92 92 92 90 92 90 90 92 92 92 92 92 90 90 90 92 90 92 92 92 92 92 90 92 92 92 92 92 92 90 92 90 92 90 92 90 92 92 92 92 92 92 92 92 92 92 90 90 92 92 92 92 92 92 90 90 92 92 92 ...
output:
? 10 82 80 28 13 16 84 81 73 49 85 45 40 44 52 95 89 17 0 87 43 21 41 38 3 30 42 32 5 53 70 55 8 98 96 90 69 50 66 11 68 58 78 75 51 29 23 67 4 33 86 61 15 71 92 64 46 27 24 19 20 57 47 65 48 72 63 12 93 60 9 31 14 34 7 25 83 79 74 97 2 37 39 77 91 35 62 59 56 26 88 94 1 6 36 18 76 22 54 ? 10 82 80 ...
result:
ok Accepted
Test #16:
score: 19
Accepted
time: 0ms
memory: 3840kb
input:
99 93 92 92 92 94 94 92 92 92 94 92 94 94 92 92 92 92 92 94 94 94 94 92 92 92 92 92 92 92 92 92 94 92 94 94 94 94 92 92 92 94 94 92 92 92 92 94 94 92 94 94 92 92 94 94 92 94 92 92 94 94 94 92 92 92 92 92 92 92 92 92 92 92 94 92 92 92 92 92 94 94 92 94 92 92 94 92 94 92 92 94 94 92 94 92 92 94 92 94 ...
output:
? 10 82 80 28 13 16 84 81 73 49 85 45 40 44 52 95 89 17 0 87 43 21 41 38 3 30 42 32 5 53 70 55 8 98 96 90 69 50 66 11 68 58 78 75 51 29 23 67 4 33 86 61 15 71 92 64 46 27 24 19 20 57 47 65 48 72 63 12 93 60 9 31 14 34 7 25 83 79 74 97 2 37 39 77 91 35 62 59 56 26 88 94 1 6 36 18 76 22 54 ? 10 82 80 ...
result:
ok Accepted
Test #17:
score: 19
Accepted
time: 2ms
memory: 3840kb
input:
99 93 94 92 94 92 92 92 94 94 94 92 92 94 92 94 94 92 94 94 92 94 92 94 92 92 94 92 92 94 92 94 94 92 92 94 94 94 92 92 92 92 94 94 92 94 92 94 92 94 94 94 92 94 92 94 94 92 94 92 94 92 92 94 92 94 92 94 92 94 94 92 92 94 92 92 94 92 92 92 94 92 92 94 94 94 92 92 92 92 92 92 94 94 92 92 92 92 94 92 ...
output:
? 10 82 80 28 13 16 84 81 73 49 85 45 40 44 52 95 89 17 0 87 43 21 41 38 3 30 42 32 5 53 70 55 8 98 96 90 69 50 66 11 68 58 78 75 51 29 23 67 4 33 86 61 15 71 92 64 46 27 24 19 20 57 47 65 48 72 63 12 93 60 9 31 14 34 7 25 83 79 74 97 2 37 39 77 91 35 62 59 56 26 88 94 1 6 36 18 76 22 54 ? 10 82 80 ...
result:
ok Accepted
Test #18:
score: 19
Accepted
time: 3ms
memory: 3840kb
input:
100 96 97 97 95 97 97 97 97 97 97 97 97 97 95 97 97 95 97 95 97 97 95 95 97 95 95 95 97 97 97 97 97 95 97 95 97 95 95 97 95 97 95 97 97 97 97 97 95 97 95 97 97 97 97 95 95 95 95 95 95 95 95 95 95 97 97 97 97 97 95 97 95 97 95 95 97 95 95 95 97 97 95 97 97 95 95 97 97 97 95 97 97 95 97 95 97 95 95 95...
output:
? 10 82 80 28 13 16 84 81 73 49 85 45 40 44 52 95 89 17 0 87 43 21 41 38 3 30 42 32 99 53 70 55 8 98 96 90 69 50 66 11 68 58 78 75 51 29 23 67 4 33 86 61 15 71 92 64 46 27 24 19 20 57 47 65 48 72 63 12 93 60 9 31 14 34 7 25 83 79 74 97 2 37 39 77 91 35 62 59 56 26 88 94 1 6 36 18 76 22 54 5 ? 10 82 ...
result:
ok Accepted
Test #19:
score: 19
Accepted
time: 3ms
memory: 3712kb
input:
100 96 95 95 95 95 95 95 95 95 95 95 95 97 97 95 95 97 95 97 95 95 95 95 95 95 97 95 95 95 95 95 95 95 95 95 95 95 97 97 95 95 95 95 95 95 95 95 95 97 95 95 97 95 95 95 97 95 95 95 95 95 97 95 95 95 95 95 95 95 95 95 95 95 95 95 97 97 95 95 95 95 95 97 97 95 95 97 95 97 95 95 95 97 95 95 95 95 97 95...
output:
? 10 82 80 28 13 16 84 81 73 49 85 45 40 44 52 95 89 17 0 87 43 21 41 38 3 30 42 32 99 53 70 55 8 98 96 90 69 50 66 11 68 58 78 75 51 29 23 67 4 33 86 61 15 71 92 64 46 27 24 19 20 57 47 65 48 72 63 12 93 60 9 31 14 34 7 25 83 79 74 97 2 37 39 77 91 35 62 59 56 26 88 94 1 6 36 18 76 22 54 5 ? 10 82 ...
result:
ok Accepted
Test #20:
score: 19
Accepted
time: 5ms
memory: 3840kb
input:
100 91 90 92 90 92 90 90 90 92 90 90 90 92 92 90 92 90 90 92 92 90 92 90 92 92 90 90 92 92 90 90 92 92 92 92 90 92 92 90 92 90 92 92 90 90 92 90 92 92 92 92 92 92 92 90 92 90 90 92 92 92 92 90 92 92 92 90 92 92 90 92 90 90 90 92 92 92 92 92 92 90 90 90 90 90 92 92 92 92 92 92 92 92 90 90 90 90 92 90...
output:
? 29 62 69 83 41 68 76 24 0 19 2 6 86 56 10 92 93 3 15 39 81 53 77 55 46 50 73 60 1 34 40 28 48 79 97 59 75 67 88 51 8 78 25 7 36 18 90 16 94 45 11 64 61 49 43 42 71 9 52 37 21 74 82 31 57 13 66 84 80 26 44 99 23 5 47 12 85 91 63 32 14 58 54 33 20 27 95 38 65 87 30 70 22 72 17 89 98 35 96 4 ? 29 62 ...
result:
ok Accepted
Test #21:
score: 19
Accepted
time: 3ms
memory: 3840kb
input:
100 91 92 92 92 90 90 90 92 92 90 90 90 90 92 92 92 92 90 90 90 92 90 92 92 90 90 92 92 90 92 90 90 90 92 92 90 90 90 92 90 92 92 90 90 92 92 90 90 90 92 92 92 90 90 92 92 92 92 90 90 90 92 90 90 90 90 92 92 90 90 92 92 92 92 92 90 90 90 90 92 90 90 92 90 90 90 92 92 90 90 92 90 90 92 92 92 92 92 90...
output:
? 29 62 69 83 41 68 76 24 0 19 2 6 86 56 10 92 93 3 15 39 81 53 77 55 46 50 73 60 1 34 40 28 48 79 97 59 75 67 88 51 8 78 25 7 36 18 90 16 94 45 11 64 61 49 43 42 71 9 52 37 21 74 82 31 57 13 66 84 80 26 44 99 23 5 47 12 85 91 63 32 14 58 54 33 20 27 95 38 65 87 30 70 22 72 17 89 98 35 96 4 ? 29 62 ...
result:
ok Accepted
Test #22:
score: 19
Accepted
time: 4ms
memory: 3840kb
input:
99 91 90 92 92 90 92 90 90 90 90 92 92 92 92 92 92 90 90 92 92 90 92 92 92 92 90 90 90 90 92 92 92 92 92 92 92 90 92 92 90 92 90 92 92 90 90 90 92 92 92 92 90 92 90 90 92 90 92 92 92 90 92 92 92 92 92 92 92 92 92 92 90 92 90 90 92 92 90 92 90 92 92 90 92 90 90 90 92 92 90 92 90 92 90 92 90 90 90 90 ...
output:
? 29 62 69 83 41 68 76 24 0 19 2 6 86 56 10 92 93 3 15 39 81 53 77 55 46 50 73 60 1 34 40 28 48 79 97 59 75 67 88 51 8 78 25 7 36 18 90 16 94 45 11 64 61 49 43 42 71 9 52 37 21 74 82 31 57 13 66 84 80 26 44 4 23 5 47 12 85 91 63 32 14 58 54 33 20 27 95 38 65 87 30 70 22 72 17 89 98 35 96 ? 29 62 69 ...
result:
ok Accepted
Test #23:
score: 19
Accepted
time: 1ms
memory: 3840kb
input:
100 95 96 96 94 94 96 94 96 96 94 94 96 94 94 94 96 94 96 94 94 94 96 94 96 94 94 94 96 96 94 94 96 96 94 96 94 96 94 94 94 96 96 94 94 94 96 96 94 96 96 94 96 94 94 94 96 96 94 94 96 96 94 94 94 96 94 94 94 94 94 96 96 94 96 96 94 94 96 94 94 94 94 96 94 94 96 94 94 96 96 94 94 94 94 96 96 94 96 94...
output:
? 29 62 69 83 41 68 76 24 0 19 2 6 86 56 10 92 93 3 15 39 81 53 77 55 46 50 73 60 1 34 40 28 48 79 97 59 75 67 88 51 8 78 25 7 36 18 90 16 94 45 11 64 61 49 43 42 71 9 52 37 21 74 82 31 57 13 66 84 80 26 44 99 23 5 47 12 85 91 63 32 14 58 54 33 20 27 95 38 65 87 30 70 22 72 17 89 98 35 96 4 ? 29 62 ...
result:
ok Accepted
Test #24:
score: 19
Accepted
time: 4ms
memory: 3712kb
input:
100 95 96 96 94 96 96 94 94 94 94 96 96 94 94 96 96 94 96 94 94 96 94 94 96 94 96 94 96 94 94 94 94 94 94 96 94 96 96 96 94 94 94 96 96 94 96 94 94 94 94 94 96 94 94 94 96 94 94 94 96 96 94 96 94 94 94 96 94 94 96 94 94 94 94 94 96 96 96 96 94 96 94 96 96 96 96 94 94 96 94 94 94 94 96 94 96 96 94 96...
output:
? 29 62 69 83 41 68 76 24 0 19 2 6 86 56 10 92 93 3 15 39 81 53 77 55 46 50 73 60 1 34 40 28 48 79 97 59 75 67 88 51 8 78 25 7 36 18 90 16 94 45 11 64 61 49 43 42 71 9 52 37 21 74 82 31 57 13 66 84 80 26 44 99 23 5 47 12 85 91 63 32 14 58 54 33 20 27 95 38 65 87 30 70 22 72 17 89 98 35 96 4 ? 29 62 ...
result:
ok Accepted
Subtask #3:
score: 0
Wrong Answer
Dependency #2:
100%
Accepted
Test #25:
score: 79
Accepted
time: 113ms
memory: 3968kb
input:
498 490 491 491 489 491 491 491 491 489 491 491 491 491 491 491 491 491 491 491 491 491 491 489 491 491 491 491 491 491 491 491 491 491 489 491 491 491 489 489 489 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 491 ...
output:
? 416 394 149 290 41 330 260 237 442 316 117 349 86 56 113 325 395 166 140 151 81 286 314 55 487 114 214 60 220 34 463 28 48 180 240 362 75 383 159 468 171 373 265 100 472 18 142 135 191 300 11 257 411 213 470 181 296 293 385 130 144 450 320 456 57 452 338 496 294 26 44 281 207 245 233 118 85 337 49...
result:
ok Accepted
Test #26:
score: 79
Accepted
time: 116ms
memory: 3712kb
input:
498 494 493 493 493 495 493 493 495 493 493 493 495 493 493 493 493 493 493 493 493 493 493 493 495 493 493 493 493 493 493 493 493 495 493 495 493 493 493 493 493 493 493 493 493 493 493 493 493 493 493 493 493 493 493 493 493 493 493 493 493 493 493 495 493 493 493 493 493 495 493 493 493 493 493 ...
output:
? 296 447 147 64 330 138 430 84 213 474 112 433 184 114 26 363 374 168 208 163 145 79 248 92 254 205 181 56 417 22 102 487 272 235 386 416 393 87 16 71 1 8 158 295 46 216 481 461 367 121 261 178 337 480 479 250 214 332 280 97 328 255 286 24 398 270 392 146 152 113 284 488 264 230 202 471 186 444 157...
result:
ok Accepted
Test #27:
score: 0
Wrong Answer
time: 210ms
memory: 3840kb
input:
498 495 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 494 496 494 494 496 496 494 494 496 496 496 494 494 494 494 494 494 494 494 494 494 494 494 494 496 494 496 494 494 496 496 494 494 494 494 494 494 494 494 494 496 494 494 494 494 494 496 494 494 494 494 ...
output:
? 136 15 316 156 117 409 180 308 119 220 441 185 244 468 46 395 122 485 108 58 61 314 76 269 197 376 203 356 172 380 289 23 200 374 38 276 94 179 440 43 309 473 85 75 272 229 312 145 201 382 238 146 31 305 91 322 48 36 140 190 401 99 0 154 211 436 210 346 406 495 347 21 206 159 66 427 171 369 270 12...
result:
wrong answer Wrong Answer [4]