Editorial for Trị tuyệt đối của đoạn con
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:
Bài toán có ~2~ thao tác
- Gán giá trị một số bằng ~x~.
- Tìm hiệu của số lớn nhất và số nhỏ nhất trong đoạn
Đây chính là bài tập áp dụng cấu trúc dữ liệu segment tree. Mỗi node của cây bao gồm ~2~ thông tin là số max và min trong đoạn. Đáp án của Query chính là hiệu của max và min trong node tìm được.
Comments