#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>> box(M);
for(int i = 0; i < S; i++) {
int lo = 0, hi = M - 1, ans = -1;
while(lo <= hi) {
int m = (lo + hi) / 2;
vector<bool> query(S, 1);
for(int x : box[m]) {
query[x] = 0;
}
query[i] = 0;
if(M - q(query) == 2) {
lo = m + 1;
}
else {
ans = m;
hi = m - 1;
}
}
box[ans].push_back(i);
}
for(vector<int> give : box) {
a(give);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
288 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 |
292 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
360 KB |
Output is correct |
2 |
Correct |
33 ms |
344 KB |
Output is correct |
3 |
Correct |
32 ms |
360 KB |
Output is correct |
4 |
Correct |
33 ms |
356 KB |
Output is correct |
5 |
Correct |
27 ms |
340 KB |
Output is correct |
6 |
Correct |
35 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1038 ms |
444 KB |
Output is correct |
2 |
Correct |
1028 ms |
444 KB |
Output is correct |
3 |
Correct |
1030 ms |
464 KB |
Output is correct |
4 |
Correct |
1000 ms |
568 KB |
Output is correct |
5 |
Correct |
965 ms |
560 KB |
Output is correct |
6 |
Correct |
1027 ms |
452 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3974 ms |
784 KB |
Output is correct |
2 |
Correct |
4131 ms |
940 KB |
Output is correct |
3 |
Correct |
3907 ms |
660 KB |
Output is correct |
4 |
Correct |
4025 ms |
648 KB |
Output is correct |
5 |
Correct |
3979 ms |
692 KB |
Output is correct |
6 |
Correct |
3757 ms |
688 KB |
Output is correct |