Editorial for Leo Thang
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
-
Subtask \(1\): Duyệt trâu, tham lam để kiểm tra với mỗi \(t\) xem \(a_{i}\) có thỏa mãn không, không thỏa mãn thì dừng lại và in kết quả là \(i-1\) ngược lại duyệt tiếp.
-
Subtask \(2\): Sử dụng kĩ thuật chặt nhị phân (binary search) để tìm \(a_{i}\) lớn nhất thỏa mãn.
-
Subtask \(3\): Cải tiến từ subtask \(2\). Tạo mảng giá trị lớn nhất tiền tố rồi làm như subtask \(2\), cụ thể: \(a_{i} = max(a_{i}, a_{i-1})\).
Comments