| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1366927 | farica | Chameleon's Love (JOI20_chameleon) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using pi = pair<int,int>;
using ll = long long;
void Solve(int N) {
vector<bool>fnd(2*N+1, 0);
for(int i=1; i<=2*N; ++i) {
if(fnd[i]) continue;
vi vec;
for(int j=i+1; j<=2*N; ++j) {
if(!fnd[j]) vec.push_back(j);
}
int siz = (int)vec.size(), l = 0, r = siz-1;
while(l < r) {
int m = (l+r)/2;
vi p;
for(int j=0; j<m; ++j) p.push_back(vec[j]);
vi p2(p.begin(), p.end());
p2.push_back(i);
int res1 = Query(p), res2 = Query(p2);
if(res1 == res2) r = m;
else l = m+1;
}
Answer(i, r);
fnd[i] = fnd[r] = 1;
}
}
