#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int pop=0;
bool nowy(int x){
  int v= Query(x);
  bool t;
  if (v!=pop)t=1;
  else t=0;
  pop=v;
  return t;
}
void bin(vector<int> a, vector<int> b){
  //for (int x:a) cerr << x << ' ';
  //cerr << '\n';
  //for (int x:b) cerr << x << ' ';
  //cerr << "\n\n";
  if (a.size()==1){
    Answer(a[0],b[0]);
    return;
  }
  if (a.size()==0)return;
  vector<int> a1,a2,b1,b2;
  for (int x=0;x<b.size()/2;x++)b1.push_back(b[x]);
  for (int x=b.size()/2;x<b.size();x++)b2.push_back(b[x]);
  for (int x:b1)pop=Query(x);
  for (int x:a){
    int temp=Query(x);
    if (temp==pop)a1.push_back(x);
    else a2.push_back(x);
    Query(x);
  }
  for (int x:b1)pop=Query(x);
  bin(a1,b1);
  bin(a2,b2);
}
void Solve(int N) {
  vector<int> a,b;
  
  for (int x=1;x<=2*N;x++){
    if (nowy(x))a.push_back(x);
    else{
      pop=Query(x);
      b.push_back(x);
    }
  }
  for (int x:a)pop=Query(x);
  bin(a,b);
}
| # | 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... |