#include "dango3.h"
using namespace std;
namespace {
int S;
int q(vector<bool> b) {
vector<int> x;
for (int i = 0; i < S; i++) {
if (b[i]) x.push_back(i + 1);
}
return Query(x);
}
void a(vector<int> v) {
for (auto &t : v) {
t++;
}
Answer(v);
}
} // namespace
void Solve(int N, int M) {
S = N * M;
vector<vector<int>> dangobox(M);
for (int i = 0; i < S; i++) {
int l, r;
l = -1;
r = M - 1;
while (l + 1 != r) {
int m = (l + r) / 2;
vector<bool> b(S, true);
for (int j = 0; j <= m; j++) {
for (int t : dangobox[j]) {
b[t] = false;
}
}
b[i] = false;
if (q(b) == M - m - 2)
l = m;
else
r = m;
}
dangobox[r].push_back(i);
}
for (int i = 0; i < M; i++) {
a(dangobox[i]);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
348 KB |
Output is correct |
2 |
Correct |
29 ms |
340 KB |
Output is correct |
3 |
Correct |
32 ms |
352 KB |
Output is correct |
4 |
Correct |
32 ms |
348 KB |
Output is correct |
5 |
Correct |
28 ms |
340 KB |
Output is correct |
6 |
Correct |
28 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
912 ms |
528 KB |
Output is correct |
2 |
Correct |
904 ms |
416 KB |
Output is correct |
3 |
Correct |
989 ms |
436 KB |
Output is correct |
4 |
Correct |
989 ms |
420 KB |
Output is correct |
5 |
Correct |
866 ms |
416 KB |
Output is correct |
6 |
Correct |
886 ms |
528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3460 ms |
588 KB |
Output is correct |
2 |
Correct |
3574 ms |
628 KB |
Output is correct |
3 |
Correct |
3869 ms |
532 KB |
Output is correct |
4 |
Correct |
3798 ms |
532 KB |
Output is correct |
5 |
Correct |
3414 ms |
488 KB |
Output is correct |
6 |
Correct |
3362 ms |
500 KB |
Output is correct |