#1034: Destroyer problem time limit:10000msSingle Point time limit:1000msMemory Limit:256MBDescribe
In the frozen Throne of Warcraft III, the destroyer was a magical flying unit that killed three of late-night.
One of the core skills of the destroyer, called magical absorption (absorb Mana):
Now let's consider the following question:
Suppose you have n Magical units, and they stand on a line from left to right, numbering from 1 to n. Each unit has three properties:
Now you manipulate a destroyer, have m operations,T l R, denote moment T, destroyer to all numbering from l to R Unit, using a magical absorption. The operation is given in chronological order to calculate how much mana the destroyer has absorbed.
Input
The first line of the input data has an integer N (1≤ n ≤105 )-The number of your magical units.
n lines with three integers per line s i , m i , R i ( s i ≤ m i ≤105, 0≤ R Sub class= "Lower-index" > i ≤105) describes a magic unit.
next line, another integer. M (1≤ m ≤105)-the number of operations.
The next m -line, each line describes an operation t, l, R(0≤ t ≤109, 1≤ l ≤ r ≤ n),T non-descending.
Output
The output line of an integer indicates how much mana the destroyer absorbed.
-
Sample input
-
50 10 10 12 10 20 10 12 10 10 125 1 519 1 5
-
Sample output
-
83
Hihocoder Challenge 1 * * * * *