Given an array of size N with all initial values as 0, write a program to perform following M range increment operations as shown below:
increment(a, b, k) : Increment values from 'a' to 'b' by 'k'. After M operations, calculate the maximum value in the array.
First line of input contains a single integer T which denotes the number of test cases. T test cases follows. First line of each test case contains two space separated integers N and M. Next M lines of each test case contains three space separated integers a , b and k.
For each test case print the maximum element in the array after M increment operations.
0<= a,b <= N-1
0 1 100
1 4 100
2 3 100
1 2 603
0 0 286
3 3 882
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.