#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);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
74 ms |
668 KB |
DO NOT WRITE ANYTHING TO STANDARD OUTPUT |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
74 ms |
668 KB |
DO NOT WRITE ANYTHING TO STANDARD OUTPUT |
2 |
Halted |
0 ms |
0 KB |
- |