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 <bits/stdc++.h>
using namespace std;
#include "dango3.h"
//im suffering from pain
int vis[20005], n, m;
int qry(vector <int> &v){
for(int i=1;i<=m*n;i++)vis[i] = 1;
for(auto i : v)vis[i] = 0;
vector <int> bru;
for(int i=1;i<=n*m;i++)if(vis[i])bru.push_back(i);
return Query(bru);
}
int ok[200005];
bool cmp(vector <int> &a, vector <int> &b){
return (int)a.size() < (int)b.size();
}
void Solve(int N, int M) {
//pain.
n = N, m = M;
vector <int> x;
for(int i=1;i<=n*m;i++){
x.push_back(i);
ok[i] = Query(x);
}
vector < vector <int> > ans;
for(int i=n*m;i>=1;i--){
if(ok[i] != ok[i-1]){
vector <int> hi = {i};
ans.push_back(hi);
}
else{
sort(ans.begin(), ans.end(), cmp);
for(auto &j : ans){
vector <int> tmp = j;
tmp.push_back(i);
if(qry(tmp) == M - 1){
j.push_back(i);
break;
}
}
}
}
for(auto i : ans)Answer(i);
}
# | 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... |