Editorial for Điểm gần thứ K
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.
Author:
Ta có thể biến đổi bài toán như sau: Cho hai số nguyên và
, tìm giá trị
nhỏ nhất thỏa mãn có ít nhất
phần tử của dãy
có giá trị nằm trong đoạn
. Từ đó, tiến hành sắp xếp mảng
và thực hiện Tìm kiếm nhị phân với mỗi truy vấn.
Độ phức tạp:
Comments