# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
893280 |
2023-12-26T20:21:41 Z |
box |
Library (JOI18_library) |
C++17 |
|
74 ms |
668 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);
}
}
}
for (int x : v) cout << x << ' ';
cout << "\n";
Answer(v);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
74 ms |
668 KB |
DO NOT WRITE ANYTHING TO STANDARD OUTPUT |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
74 ms |
668 KB |
DO NOT WRITE ANYTHING TO STANDARD OUTPUT |
2 |
Halted |
0 ms |
0 KB |
- |