// let's hope this works
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int var = 0;
} // namespace
random_device rd;
mt19937 g(rd());
void Solve(int N, int M) {
vector<int> p;
for (int i = 1; i <= N * M; i++) p.push_back(i);
shuffle(p.begin(), p.end(), g);
vector<int> sus(N * M + 1, 0);
vector<vector<int>> amogus(M + 1);
vector<vector<bool>> rizz(M + 1, vector<bool> (N * M + 1, 0));
for (int ii = 1; ii <= N * M; ii++) {
int i = p[ii - 1];
int l = 1, r = M;
while (l < r) {
int it = (l + r) / 2;
rizz[it][i] = 1;
vector<int> alice;
for (int j = 1; j <= N * M; j++) if (!rizz[it][j]) alice.push_back(j);
rizz[it][i] = 0;
if (Query(alice) < M - 1) l = it + 1;
else r = it;
}
amogus[l].push_back(i);
rizz[l][i] = 1;
}
for (int it = 1; it <= M; it++) Answer(amogus[it]);
}
Compilation message
dango3.cpp:9:5: warning: '{anonymous}::var' defined but not used [-Wunused-variable]
9 | int var = 0;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 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 |
432 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
348 KB |
Output is correct |
2 |
Correct |
11 ms |
520 KB |
Output is correct |
3 |
Correct |
11 ms |
344 KB |
Output is correct |
4 |
Correct |
11 ms |
348 KB |
Output is correct |
5 |
Correct |
11 ms |
348 KB |
Output is correct |
6 |
Correct |
11 ms |
528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
554 ms |
660 KB |
Output is correct |
2 |
Correct |
548 ms |
604 KB |
Output is correct |
3 |
Correct |
588 ms |
604 KB |
Output is correct |
4 |
Correct |
575 ms |
600 KB |
Output is correct |
5 |
Correct |
540 ms |
604 KB |
Output is correct |
6 |
Correct |
545 ms |
636 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2374 ms |
848 KB |
Output is correct |
2 |
Correct |
2325 ms |
848 KB |
Output is correct |
3 |
Correct |
2540 ms |
848 KB |
Output is correct |
4 |
Correct |
2570 ms |
848 KB |
Output is correct |
5 |
Correct |
2366 ms |
776 KB |
Output is correct |
6 |
Correct |
2290 ms |
812 KB |
Output is correct |