Company: Buyhatke_15july
Difficulty: medium
Tan and Test Cases Problem Description Tan prepares test data for an array problem. He starts with an array A of N integers, positions numbered 1 through N , and sends it to his reviewers. The first reviewer, Taru , applies Q operations. Each operation is a triple (l, r, k) and means: add k to every element at positions l through r , inclusive. k may be negative, in which case those elements decrease. The operations are applied in the order given. The second reviewer, Shubhanshu , then works on the array Taru produced. He first reverses the whole array , and only after that applies his own P operations. Each of his operations is a triple (l, r, k) and means: subtract k from every element at positions l through r , inclusive, of the reversed array. k may be negative here too, in which case those elements increase. These operations are also applied in the order given. Call the array that remains B . Now B is cut into subarrays: scanning left to right, each subarray is extended as long as