頁面無法載入?點擊這裡可能會修復。
Placeholder

#5509

Hungry Cow 6s 512MB

問題

**Note: The time limit for this problem is 6s, three times the default. The memory limit for this problem is 512MB, twice the default.**

 

Bessie is a hungry cow. Each day, for dinner, if there is a haybale in the barn, she will eat one haybale. Farmer John does not want Bessie to starve, so some days he sends a delivery of haybales, which arrive in the morning (before dinner). In particular, on day di, Farmer John sends a delivery of bi haybales (1≤di≤1014, 0≤bi≤109).

 

Process U (1≤U≤105) updates as follows: Given a pair (d,b), update the number of haybales arriving on day d to b. After each update, output the sum of all days on which Bessie eats haybales modulo 109+7.​


輸入

U , followed by U lines containing the updates.​


輸出

The sum after each update modulo 109+7

​ 


範例 #1

3

4 3
1 5
1 2
15

36
18

範例 #2

9

1 89
30 7
101 26
1 24
5 1
60 4
5 10
101 0
1 200
4005

4656
7607
3482
3507
3753
4058
1107
24531


來源

USACO 2023 February Platinum

需要登入才能撰寫程式碼。