Difference Array Simulation

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Larry is learning difference arrays. However, he is not sure which elements needs to be changed for each range update.

He wants you to tell him which indices will be changed for each range update.

As a reminder, when adding a value v to a subarray [l, r], we add v to index l and subtract v from index r+1.

Input Specification

The first line will contain the integer Q (1 \le Q \le 100), the number of updates.

The next Q lines will each contain 2 integers l, r (1 \le l \le r \le 10^9).

Output Specification

For each update, print which indices will the changed on its own line for Larry.

Sample Input

4
1 2
3 3
2 4
3 5

Sample Output

1 3
3 4
2 5
3 6

Comments

There are no comments at the moment.