#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
void Solve(int n,int m){
n*=m;
vector<vector<int>> ans(m);
auto ask=[&](const vector<bool> a){
vector<int> b;
for(int i=1;i<=n;i++)if(a[i])b.emplace_back(i);
return m-Query(b)-1;
};
for(int i=1;i<=n;i++){
int l=0,r=m-1;
while(l<r){
int md=(l+r)/2;
vector<bool> ok(n+1,true);
ok[i]=false;
for(int j=0;j<=md;j++)for(auto x:ans[j])ok[x]=false;
if(ask(ok)<=md)r=md;
else l=md+1;
}
ans[l].emplace_back(i);
}
for(auto &x:ans)Answer(x);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
512 KB |
Output is correct |
2 |
Correct |
9 ms |
500 KB |
Output is correct |
3 |
Correct |
10 ms |
348 KB |
Output is correct |
4 |
Correct |
9 ms |
440 KB |
Output is correct |
5 |
Correct |
9 ms |
348 KB |
Output is correct |
6 |
Correct |
10 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
334 ms |
592 KB |
Output is correct |
2 |
Correct |
380 ms |
348 KB |
Output is correct |
3 |
Correct |
412 ms |
596 KB |
Output is correct |
4 |
Correct |
445 ms |
576 KB |
Output is correct |
5 |
Correct |
394 ms |
572 KB |
Output is correct |
6 |
Correct |
410 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1770 ms |
600 KB |
Output is correct |
2 |
Correct |
1747 ms |
912 KB |
Output is correct |
3 |
Correct |
1995 ms |
856 KB |
Output is correct |
4 |
Correct |
1909 ms |
672 KB |
Output is correct |
5 |
Correct |
1608 ms |
680 KB |
Output is correct |
6 |
Correct |
1489 ms |
908 KB |
Output is correct |