#PU1308. USACO 2023 February Contest, Platinum — Problem 1. Hungry Cow

    ID: 1409 传统题 6000ms 512MiB 尝试: 0 已通过: 0 难度: 省选/NOI- 上传者: 标签>USACO赛事:feb23来源:usaco.orgscoring:equal_test_cases线段树

USACO 2023 February Contest, Platinum — Problem 1. Hungry Cow

USACO 2023 February Contest, Platinum — Problem 1. Hungry Cow

题目描述

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 did_i, Farmer John sends a delivery of bib_i haybales (1≤di≤10141\leq d_i \leq 10^{14}, 0≤bi≤1090\leq b_i \leq 10^9). Process UU (1≤U≤1051\le U\le 10^5) updates as follows: Given a pair (d,b)(d, b), update the number of haybales arriving on day dd to bb. After each update,

输入格式

UU, followed by UU lines containing the updates.

输出格式

The sum after each update modulo 109+710^9+7.

数据范围

(见题面原文)

样例

样例 1

3
4 3
1 5
1 2
15
36
18
Answers after each update:
4+5+6=15
1+2+3+4+5+6+7+8=36
1+2+4+5+6=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