#include <bits/stdc++.h> using namespace std; int solve(int *a1, int *a2, int n, int k) { int left1 = 0, right1 = n - 1; int left2 = 0, right2 = n - 1; while (left1 <= right1 && left2 <= right2) { int m1 = (left1 + right1) >> 1; int m2 = (left2 + right2) >> 1; int cnt = __(1)__; if (__(2)__) { if (cnt < k) left1 = m1 + 1; else right2 = m2 - 1; } else { if (cnt < k) left2 = m2 + 1; else right1 = m1 - 1; } } if (__(3)__) { if (left1 == 0) { return a2[k - 1]; } else { int x = a1[left1 - 1], __(4)__ ; return std::max(x, y); } } else { if (left2 == 0) { return a1[k - 1]; } else { int x = a2[left2 - 1], __(5)__ ; return std::max(x, y); } } }