# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
893281 |
2023-12-26T20:21:57 Z |
box |
Library (JOI18_library) |
C++17 |
|
197 ms |
944 KB |
#include <bits/stdc++.h>
using namespace std;
#define ar array
#define sz(v) int(std::size(v))
using i64 = long long;
#include "library.h"
void Solve(int N) {
auto Q = [&](vector<int> v) {
vector<int> u(N);
for (int x : v) u[x - 1] = 1;
return Query(u);
};
vector<int> v = {1};
for (int x = 2; x <= N; x++) {
int z = -1;
for (int y = 1; y <= N; y++) if (find(begin(v), end(v), y) == end(v)) {
v.push_back(y);
if (Q(v) == 1) {
z = y;
break;
} else v.pop_back();
}
assert(~z);
v.pop_back();
if (x == 2) v.push_back(z);
else {
int y = v.back();
v.pop_back();
v.push_back(z);
if (Q(v) == 1) {
v.pop_back();
v.push_back(y);
v.insert(begin(v), z);
} else {
v.pop_back();
v.push_back(y);
v.push_back(z);
}
}
}
Answer(v);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
77 ms |
672 KB |
# of queries: 8884 |
2 |
Correct |
68 ms |
684 KB |
# of queries: 8522 |
3 |
Correct |
86 ms |
668 KB |
# of queries: 8998 |
4 |
Correct |
78 ms |
944 KB |
# of queries: 9859 |
5 |
Correct |
88 ms |
432 KB |
# of queries: 10046 |
6 |
Correct |
83 ms |
928 KB |
# of queries: 9415 |
7 |
Correct |
91 ms |
680 KB |
# of queries: 9868 |
8 |
Correct |
77 ms |
944 KB |
# of queries: 9922 |
9 |
Correct |
84 ms |
932 KB |
# of queries: 9823 |
10 |
Correct |
29 ms |
428 KB |
# of queries: 4097 |
11 |
Correct |
0 ms |
344 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
344 KB |
# of queries: 1 |
13 |
Correct |
1 ms |
344 KB |
# of queries: 3 |
14 |
Correct |
0 ms |
344 KB |
# of queries: 6 |
15 |
Correct |
1 ms |
344 KB |
# of queries: 88 |
16 |
Correct |
2 ms |
344 KB |
# of queries: 236 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
77 ms |
672 KB |
# of queries: 8884 |
2 |
Correct |
68 ms |
684 KB |
# of queries: 8522 |
3 |
Correct |
86 ms |
668 KB |
# of queries: 8998 |
4 |
Correct |
78 ms |
944 KB |
# of queries: 9859 |
5 |
Correct |
88 ms |
432 KB |
# of queries: 10046 |
6 |
Correct |
83 ms |
928 KB |
# of queries: 9415 |
7 |
Correct |
91 ms |
680 KB |
# of queries: 9868 |
8 |
Correct |
77 ms |
944 KB |
# of queries: 9922 |
9 |
Correct |
84 ms |
932 KB |
# of queries: 9823 |
10 |
Correct |
29 ms |
428 KB |
# of queries: 4097 |
11 |
Correct |
0 ms |
344 KB |
# of queries: 0 |
12 |
Correct |
0 ms |
344 KB |
# of queries: 1 |
13 |
Correct |
1 ms |
344 KB |
# of queries: 3 |
14 |
Correct |
0 ms |
344 KB |
# of queries: 6 |
15 |
Correct |
1 ms |
344 KB |
# of queries: 88 |
16 |
Correct |
2 ms |
344 KB |
# of queries: 236 |
17 |
Runtime error |
197 ms |
436 KB |
Execution killed with signal 13 |
18 |
Halted |
0 ms |
0 KB |
- |