This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |