#include "dango3.h"
#include <vector>
/*
Find maximum amount by flipping everything
*/
void Solve(int N, int M){
std::vector<int> groups(N*M,-1);
for(int i=0;i<N*M;i++){
int lower=-1,upper=M-1;
while(lower+1<upper){
int mid=(lower+upper)/2;
std::vector<int> ugroup;
for(int j=0;j<N*M;j++){
if(groups[j]!=mid&&j!=i)ugroup.push_back(j+1);
}
if(Query(ugroup)<M-1){
lower=mid;
}else{
upper=mid;
}
}
groups[i]=upper;
}
for(int i=0;i<M;i++){
std::vector<int> curgroup;
for(int j=0;j<N*M;j++){
if(groups[j]==i)curgroup.push_back(j+1);
}
Answer(curgroup);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
348 KB |
Output is correct |
2 |
Correct |
10 ms |
496 KB |
Output is correct |
3 |
Correct |
10 ms |
496 KB |
Output is correct |
4 |
Correct |
10 ms |
488 KB |
Output is correct |
5 |
Correct |
10 ms |
344 KB |
Output is correct |
6 |
Correct |
10 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
555 ms |
596 KB |
Output is correct |
2 |
Correct |
527 ms |
564 KB |
Output is correct |
3 |
Correct |
573 ms |
344 KB |
Output is correct |
4 |
Correct |
566 ms |
348 KB |
Output is correct |
5 |
Correct |
566 ms |
348 KB |
Output is correct |
6 |
Correct |
524 ms |
568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2272 ms |
604 KB |
Output is correct |
2 |
Correct |
2291 ms |
604 KB |
Output is correct |
3 |
Correct |
2443 ms |
604 KB |
Output is correct |
4 |
Correct |
2473 ms |
676 KB |
Output is correct |
5 |
Correct |
2259 ms |
600 KB |
Output is correct |
6 |
Correct |
2336 ms |
732 KB |
Output is correct |