#include "dango3.h"
#ifdef LOCAL
#include "grader.cpp"
#endif // LOCAL
#include <vector>
#include <random>
#include <algorithm>
std::mt19937 rng(123);
void Solve(int n, int m) {
std::vector<int> id(n * m + 1);
for (int i = 1; i <= n * m; i++) {
id[i] = i;
}
shuffle(id.begin() + 1, id.end(), rng);
auto query = [&] (std::vector<int> v) {
return Query(v);
};
bool taken[n * m + 1] = {};
for (int baubau = 0; baubau < m; baubau++) {
std::vector<int> cur = {};
for (int i = 1; i <= n * m; i++) {
if (!taken[id[i]]) {
cur.push_back(id[i]);
taken[id[i]] = true;
break;
}
}
for (int rep = 2; rep <= n; rep++) {
std::vector<int> ask = cur;
for (int i = 1; i <= n * m; i++) {
if (taken[id[i]]) {
continue;
}
ask.push_back(id[i]);
if (query(ask) == 1) {
cur.push_back(id[i]);
taken[id[i]] = true;
break;
}
}
}
Answer(cur);
}
}
/**
3 2
3 3 1 2 1 2
4 4
2 2 3 2 4 4 3 2 3 1 1 3 4 1 4 1
**/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
348 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
39 ms |
348 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
77 ms |
600 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |