Oracle Prophecy Counts
View as PDFOracle Prophecy Counts
In the Ancient Greece there are lots of Oracles. Each of the Oracles makes prophecies everyday. Overtime there is variation in this. The Priest decides to take regular counts and writes these down on his tablets. This is what the entries look like.
...
35 1234 -2
14 2345 +3
...
The first entry indicates that on day , Oracle \(#1234's\) prophecy counts were
lower than it was when last measured. The next entry indicates that on day
, Oracle \(#2345's\) prophecy count increased by
from when it was last measured. The Priest has only enough time to make at most one measurement on any given day. Unfortunately, he is a bit disorganized, and doesn't necessarily write down his measurements in chronological order.
To keep his Oracles motivated, Priese proudly displays on the wall of the Temple, the picture of whichever Oracle currently has the highest prophecy count (if several oracles tie for the highest count, he displays all of their pictures).
Please determine the number of days on which the Priest would have needed to change this display.
Note that the Priest has a very large number of Oracles, so although some of them are noted in his log book as changing their prophecy count , there are always plenty of other Oracles around whose prophecy count remains at P counts.
INPUT FORMAT
The first line of input contains the number of measurements that the Priest makes, followed by
. Each of the next
lines contains one measurement, in the format above, specifying a
, the
, and the change in her prophecy count since it was last measured (a nonzero integer).
SAMPLE INPUT:
4 10
7 3 +3
4 2 -1
9 3 -1
1 1 +2
OUTPUT FORMAT
Please output the total counts of days on which The Priest needs to adjust his temple display. This would be a single number. e.g. if he updates twice the answer is 2.
In the sample below Priest update the display on 3 separate days.
SAMPLE OUTPUT:
3
Constraints
Comments