#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int query(set<int> st) {
vector<int> a;
for (int x : st) a.push_back(x);
return Query(a);
}
} // namespace
void Solve(int N, int M) {
vector<vector<int>> byGroup;
byGroup.resize(M);
for (int i=1; i<=N*M; i++) {
int lb=0, ub=M-1;
while (lb != ub) {
int mid=(lb+ub+1)/2;
set<int> s;
for (int j=1; j<=N*M; j++)
s.insert(j);
for (int j=0; j<mid; j++)
for (int x : byGroup[j])
s.erase(x);
s.erase(i);
int res = query(s);
if (res >= M - mid) ub = mid-1;
else lb = mid;
}
byGroup[lb].push_back(i);
}
for (int i=0; i<M; i++) {
Answer(byGroup[i]);
}
}
// #include "grader.cpp"
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
456 ms |
440 KB |
Output is correct |
2 |
Correct |
464 ms |
340 KB |
Output is correct |
3 |
Correct |
473 ms |
440 KB |
Output is correct |
4 |
Correct |
456 ms |
440 KB |
Output is correct |
5 |
Correct |
397 ms |
436 KB |
Output is correct |
6 |
Correct |
426 ms |
448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
10043 ms |
884 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
10053 ms |
1416 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |