Need help at a max/min range problem
Difference between en1 and en2, changed 128 character(s)
Link to contest (statement in Vietnamese): https://lqdoj.edu.vn/contest/dhbb23, problem link: https://lqdoj.edu.vn/problem/dhbb23hkdata. (you must virtual join the contest before open the problem)↵
↵
Summary: Given a array $a$ with $n$ elements, the cost of this array is the maximum value of $|\sum^{R}_{i = L}\ a_i|$ among all pairs $1\leq L\leq R\leq n$. There are $q$ $\bf {independent}$ updates of the form $l\ r\ c$: increase all elements from $l$ to $r$ by $c$, then calculate the cost of array after the update. $n,\ q\leq 10^5,\ |a_i|,\ |c|\leq 10^9$.↵
↵
Thanks for your help and attention, have a good day.
↵
↵
Update: I just solved this problem using a CHT Segment Tree (code here: https://ideone.com/5BWLxX), thanks for all the help!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English nhphuc 2025-04-11 19:28:02 128
en1 English nhphuc 2025-04-11 10:37:57 652 Initial revision (published)