#include "dango3.h"
#include <vector>
#include <iostream>
namespace {
using namespace std;
}
void Solve(int n, int m) {
vector<vector<int>> a(m);
vector<char> v(n * m + 1);
for (int i = 1; i <= n * m; i++) {
int lo = 0, hi = m - 1;
while (lo < hi) {
int mi = (lo + hi) / 2;
fill(v.begin(), v.end(), 0);
for (int j : a[mi])
v[j] = true;
v[i] = true;
vector<int> b;
for (int j = 1; j <= n * m; j++)
if (!v[j]) b.push_back(j);
if (m == Query(b) + 1) hi = mi;
else lo = mi + 1;
}
a[hi].push_back(i);
}
for (int i = 0; i < m; i++)
Answer(a[i]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
32 ms |
356 KB |
Output is correct |
2 |
Correct |
32 ms |
472 KB |
Output is correct |
3 |
Correct |
30 ms |
340 KB |
Output is correct |
4 |
Correct |
33 ms |
368 KB |
Output is correct |
5 |
Correct |
33 ms |
340 KB |
Output is correct |
6 |
Correct |
33 ms |
352 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1040 ms |
468 KB |
Output is correct |
2 |
Correct |
1022 ms |
480 KB |
Output is correct |
3 |
Correct |
996 ms |
720 KB |
Output is correct |
4 |
Correct |
1006 ms |
484 KB |
Output is correct |
5 |
Correct |
985 ms |
696 KB |
Output is correct |
6 |
Correct |
974 ms |
588 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4011 ms |
800 KB |
Output is correct |
2 |
Correct |
3967 ms |
824 KB |
Output is correct |
3 |
Correct |
3976 ms |
620 KB |
Output is correct |
4 |
Correct |
3973 ms |
692 KB |
Output is correct |
5 |
Correct |
3906 ms |
724 KB |
Output is correct |
6 |
Correct |
4091 ms |
572 KB |
Output is correct |