intSolution::searchMatrix(vector<vector<int> > &A, int B){ int l = 0, r = A.size() - 1; while(l <= r) { int m = l + (r - l) / 2; if(A[m].front() <= B and B <= A[m].back()) return *lower_bound(begin(A[m]), end(A[m]), B) == B; elseif(A[m].back() < B) l = m + 1; else r = m - 1; } return0; }