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;
typedef long long ll;
typedef pair<int,int> pii;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
void Solve(int N, int M) {
vector<vector<int>> a;
for(int i = 1; i <= N*M; i++) {
// vamos ver onde pôr o elemento i
int l = 0, r = sz(a) - 1;
while(l <= r) {
int mid = (l+r)/2;
vector<bool> q(N*M, 1);
for(auto it : a[mid]) q[it-1] = 0;
q[i - 1] = 0;
vector<int> make_query;
for(int j = 1; j <= N*M; j++) if(q[j-1]) make_query.pb(j);
if(Query(make_query) == M-1) r = mid-1;
else l = mid+1;
}
if(r+1 >= sz(a)) a.pb({i});
else a[r+1].pb(i);
}
for(int i = 0; i < M; i++) Answer(a[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... |