#PU763. USACO 2017 December Contest, Silver — Problem 2. Milk Measurement

    ID: 1247 传统题 文件IO:measurement 2000ms 256MiB 尝试: 0 已通过: 0 难度: 提高 上传者: 标签>USACO赛事:dec17来源:usaco.orgscoring:equal_test_cases差分前缀和

USACO 2017 December Contest, Silver — Problem 2. Milk Measurement

USACO 2017 December Contest, Silver — Problem 2. Milk Measurement

题目描述

Each of Farmer John's cows initially produces GG gallons of milk per day (1≤G≤1091 \leq G \leq 10^9). Since the milk output of a cow is known to potentially change over time, Farmer John decides to take periodic measurements of milk

输入格式

The first line of input contains the number of measurements NN that Farmer John makes (1≤N≤100,0001 \leq N \leq 100,000), followed by GG. Each of the next NN lines contains one measurement, in the format above, specifying a day (an integer in the range 1…1061 \ldots 10^6), the integer ID of a cow (in the range 1…1091 \ldots 10^9), and the change in her milk output since it was last measured (a nonzero integer). Each cow's milk output will always be in the range 0…1090 \ldots 10^9.

输出格式

Please output the number of days on which Farmer John needs to adjust his motivational display.

数据范围

(见题面原文)

样例

样例 1

4 10
7 3 +3
4 2 -1
9 3 -1
1 1 +2
3
Problem credits: Brian Dean

提示

are noted in his log book as changing their milk production, there are always plenty of other cows around whose milk output level remains at GG gallons.