#include <bits/stdc++.h>
//~ #include "minerals.h"
#include "grader.cpp"
using namespace std;
vector <int> s, e;
int curl, curr;
void solve(int l, int r, vector <int> &cur){
if(r < l) return;
if(l == r){
assert(cur.size() == 1);
Answer(e[l], cur[0]);
return;
}
int mid = (l + r) / 2;
while(curl > l){
l--;
Query(e[curl]);
}
while(curr < r){
curr++;
Query(e[curr]);
}
while(curl < l){
Query(e[curl]);
curl++;
}
while(curr > mid){
Query(e[curr]);
curr--;
}
vector <int> left, right;
for(auto &i : cur){
int x = Query(i);
if(x == mid - l + 1) left.push_back(i);
else right.push_back(i);
Query(i);
}
solve(l, mid, left);
solve(mid + 1, r, right);
}
void Solve(int N){
int prev = 0;
for(int i = 1 ; i <= 2 * N ; i++){
int cur = Query(i);
if(cur != prev) s.push_back(i);
else e.push_back(i);
prev = cur;
}
for(auto &i : s) Query(i);
curl = 0;
curr = N - 1;
solve(0, N - 1, s);
}
Compilation message
/tmp/cckbRdgW.o: In function `Query(int)':
grader.cpp:(.text+0x20): multiple definition of `Query(int)'
/tmp/ccaTMgqr.o:minerals.cpp:(.text+0x20): first defined here
/tmp/cckbRdgW.o: In function `Answer(int, int)':
grader.cpp:(.text+0xf0): multiple definition of `Answer(int, int)'
/tmp/ccaTMgqr.o:minerals.cpp:(.text+0xf0): first defined here
/tmp/cckbRdgW.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccaTMgqr.o:minerals.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status