#include "dango3.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "/home/eagle/apio17/joi_sc22_4/debug.h"
#else
#define debug(...) void(37)
#endif
void Solve(int N, int M) {
auto Ask = [&](vector<int> x) {
vector<bool> in(N * M);
for (auto& v : x) {
in[v] = true;
}
vector<int> ask;
for (int i = 0; i < N * M; ++i) {
if (!in[i]) {
ask.push_back(i + 1);
}
}
int res = Query(ask);
return M - res;
};
vector<vector<int>> gs(M);
for (int i = 0; i < N * M; ++i) {
int low = 0, high = M - 1;
while (low < high) {
int mid = (low + high) >> 1;
vector<int> a = gs[mid];
a.push_back(i);
debug(a, Ask(a));
if (Ask(a) > 1) {
low = mid + 1;
} else {
high = mid;
}
}
gs[low].push_back(i);
}
for (auto& x : gs) {
for (auto& e : x) {
e += 1;
}
Answer(x);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
308 KB |
Output is correct |
5 |
Correct |
0 ms |
304 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
304 KB |
Output is correct |
2 |
Correct |
13 ms |
340 KB |
Output is correct |
3 |
Correct |
17 ms |
372 KB |
Output is correct |
4 |
Correct |
14 ms |
392 KB |
Output is correct |
5 |
Correct |
15 ms |
340 KB |
Output is correct |
6 |
Correct |
16 ms |
388 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
423 ms |
496 KB |
Output is correct |
2 |
Correct |
391 ms |
496 KB |
Output is correct |
3 |
Correct |
468 ms |
436 KB |
Output is correct |
4 |
Correct |
449 ms |
452 KB |
Output is correct |
5 |
Correct |
412 ms |
592 KB |
Output is correct |
6 |
Correct |
380 ms |
472 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1601 ms |
644 KB |
Output is correct |
2 |
Correct |
1578 ms |
636 KB |
Output is correct |
3 |
Correct |
1795 ms |
688 KB |
Output is correct |
4 |
Correct |
1758 ms |
648 KB |
Output is correct |
5 |
Correct |
1589 ms |
732 KB |
Output is correct |
6 |
Correct |
1584 ms |
704 KB |
Output is correct |