# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
211864 | 3zp | Chameleon's Love (JOI20_chameleon) | C++14 | 0 ms | 0 KiB |
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 "chameleon.h"
#include <bits/stdc++.h>
using namespace std;
int f[1009],g[1009], n;
int ask(vector<int> a, int b){
a.push_back(b);
return Query(a);
}
bool check(int a, int b){
vector<int> v;
for(int i = 1; i <= 2*n; i++)
if(i != a && i != b)
v.push_back(i);
return Query(v) != n;
}
int solve(vector<int> v, int x, int d){
int lo = 0, hi = v.size()-1;
while(lo < hi){
int mid = (lo + hi)/2;
vector<int> w;
for(int i = 0; i <= mid; i++)
w.push_back(v[i]);
w.push_back(x);
if(Query(w) <= mid + 1 - d)
hi = mid;
else lo = mid + 1;
}
return v[lo];
}
void ans(int x, int y){
g[x] = 1; g[y] = 1;
Answer(x, y);
}
}