이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |