#abc221d. D - Online games

D - Online games

Score : 400400 points

问题描述

存在一款拥有 NN 名注册玩家的在线游戏。
今天是游戏上线以来的第 1010010^{100} 天,开发者高桥检查了用户的登录记录。结果显示,第 ii 位玩家从第 AiA_i 天开始连续登录了 BiB_i 天,其中第 11 天为游戏上线首日,并且在其他日期没有登录。换句话说,第 ii 位玩家在第 AiA_iAi+1A_i+1\ldotsAi+Bi1A_i+B_i-1 天登录,并且仅在这几天登录。

对于每个满足 1kN1\leq k\leq N 的整数 kk,请找出恰好有 kk 名玩家登录的天数。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

There is an online game with NN registered players.
Today, which is the 1010010^{100}-th day since its launch, the developer Takahashi examined the users' login history. It turned out that the ii-th player logged in for BiB_i consecutive days from Day AiA_i, where Day 11 is the launch day, and did not log in for the other days. In other words, the ii-th player logged in on Day AiA_i, Ai+1A_i+1, \ldots, Ai+Bi1A_i+B_i-1, and only on those days.
For each integer kk such that 1kN1\leq k\leq N, find the number of days on which exactly kk players logged in.

Constraints

  • 1N2×1051 \leq N \leq 2\times 10^5
  • 1Ai1091 \leq A_i \leq 10^9
  • 1Bi1091 \leq B_i \leq 10^9
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

A1A_1 B1B_1

A2A_2 B2B_2

::

ANA_N BNB_N

Output

Print NN integers with spaces in between, as follows:

D1D_1 D2D_2 \cdots DND_N

Here, DiD_i denotes the number of days on which exactly kk players logged in.

Sample Input 1

3
1 2
2 3
3 1

Sample Output 1

2 2 0

The first player logged in on Day 11, 22, the second player logged in on Day 22, 33, 44, and the third player logged in on Day 33 only.

Thus, we can see that Day 11, 44 had 11 player logged in, Day 22, 33 had 22 players logged in, and the other days had no players logged in.

The answer is: there were 22 days with exactly 11 player logged in, 22 days with exactly 22 players logged in, and 00 days with exactly 33 players logged in.

Sample Input 2

2
1000000000 1000000000
1000000000 1000000000

Sample Output 2

0 1000000000

There may be two or more players who logged in during the same period.

update @ 2024/3/10 09:45:09