M is an n*n matrix. Is it possible to code a data structure that supports these operations:
- addValue(x1, x2, y1, y2, a): Adds a to every element M[y1...y2][x1...x2]. Should work in O(log^2 n).
- getMin(x1, x2, y1, y2): Returns minimum from elements M[y1...y2][x1...x2]. Should work in O(log^2 n).
I tried to solve this with 2d segment tree but nothing works because of the min QAQ
Treap of Segment trees :)
And how exactly will it help you with this problem?
What does QAQ mean?
That is an emoticon.