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 "minerals.h"
#include <bits/stdc++.h>
using namespace std;
int lans = 0;
int qry(int x){
int ans = Query(x);
swap(lans, ans);
return lans != ans;
}
void dnc(vector<int> &v1, vector<int> &v2, bool lin){
int sz = v1.size(), mid = min(1, (int)(sz * 0.4));
if (sz == 1){
Answer(v1[0], v2[0]);
return;
}
vector<int> l1, l2, r1, r2;
for (int i = 0; i < mid; i++){
qry(v1[i]); l1.push_back(v1[i]);
}
for (int i = mid; i < sz; i++) r1.push_back(v1[i]);
for (int i = 0; i < sz; i++){
if (l2.size() == l1.size()) r2.push_back(v2[i]);
else if (r2.size() == r1.size()) l2.push_back(v2[i]);
else{
if (lin != qry(v2[i])) l2.push_back(v2[i]);
else r2.push_back(v2[i]);
}
}
dnc(l1, l2, !lin); dnc(r1, r2, lin);
}
void Solve(int N){
vector<int> v1, v2;
for (int i = 1; i <= 2 * N; i++){
if (qry(i)) v1.push_back(i);
else v2.push_back(i);
}
dnc(v1, v2, 0);
}
# | 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... |
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |