#pragma comment(linker, "/STACK:102400000,102400000") #include #include #include #include #include #include using namespace std; typedef long long LL; typedef vector VI; #define REP(i,n) for(int i=0, i##_len=(n); i inline void amin(T &x, const T &y) { if (y inline void amax(T &x, const T &y) { if (x 1) { mid = (lo + hi) / 2; (ok()? hi: lo) = mid; } printf("%d\n", (int)hi); } int main() { scanf("%d", &T); REP (i, T) MAIN(); return 0; }