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 <bits/stdc++.h>
using namespace std;
const int N=10005;
void Solve(int n, int m) {
vector<int> vis(N);
for (int i = 0; i < m; i++) {
vector<int> a;
for(int j=1;j<=n*m;j++){
if(!vis[j]){
a.push_back(j);
}
}
shuffle(a.begin(),a.end(),mt19937(time(0)));
int sz=a.size();
int l=0,r=sz;
while(r-l>1){
int m=(l+r)>>1;
if(Query(vector(a.begin(),a.begin()+m))>=1){
r=m;
}
else{
l=m;
}
}
vector<int> t(sz);
for(int j=0;j<r;j++){
t[j]=1;
}
for(int j=0;j<r;j++){
t[j]=0;
vector<int> v;
for(int k=0;k<r;k++){
if(t[k]){
v.push_back(a[k]);
}
}
if(Query(v)==0){
t[j]=1;
}
}
vector<int> v;
for(int k=0;k<r;k++){
if(t[k]){
v.push_back(a[k]);
vis[a[k]]=1;
}
}
Answer(v);
}
}
# | 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... |