Just learned new data structure for problem G. Penacony that makes use of lazy segment tree in order to solve it.
References: https://www.youtube.com/watch?v=iMjd2QI6NEs (from this comment) https://www.scaler.com/topics/data-structures/segment-tree-with-lazy-propagation/ https://codeforces.me/blog/entry/131528