이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
int n,m;
bool check(int want, vector<int> temp, vector<int> a) {
vector<int> h;
for (auto s : a) {
auto it=lower_bound(temp.begin(),temp.end(),s);
if (it==temp.end() || *it!=s) h.push_back(s);
}
if (Query(h)>=want) return true;
else return false;
}
void find(int l, int r, vector<int> a) {
if (l==r) Answer(a);
else {
int mid=(l+r)/2;
vector<int> temp1,temp2;
for (auto s : a) {
temp1.push_back(s);
if (!check(r-mid,temp1,a)) {
temp1.pop_back();
temp2.push_back(s);
}
}
find(l,mid,temp1);
find(mid+1,r,temp2);
}
}
void Solve(int N, int M) {
n=N; m=M;
vector<int> v;
for (int i=1; i<=n*m; ++i) v.push_back(i);
find(1,m,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... |