Editorial for HSG THPT Hải Phòng 2022 - Bài 3
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.
Ta sẽ dùng chặt nhị phân kết quả cho bài toán này.
Nhận thấy thời gian càng lớn, thì bé Bo sẽ càng có nhiều trứng.
Cụ thể với thời gian là ~T~, thì số lượng trứng được tính như sau:
$$Eggs = \sum_{i = 1, p_i \le T}^{n}{(1+\lfloor{\frac{T - p_i}{t_i}}}\rfloor)$$
Vậy với mỗi lần ta xét một giá trị ~T~, nếu số lượng trứng tìm được lớn hơn hoặc bằng ~x~ (~Eggs \ge x~), ta cập nhật kết quả với ~T~.
Comments