UVA12299 RMQ with Shifts

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=244&page=show_problem&problem=3720 [PDF](https://uva.onlinejudge.org/external/122/p12299.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12299/37429cb2f857aaacd9179cd7577b0be862c9ee08.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12299/e43988da8ae356433fb021e3e8920b9ecef38f7a.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12299/618910b1db9e97e5cb9efc6ffe95d799ebeb4c27.png)