#abc260e. E - At Least One

E - At Least One

Score : 500500 points

问题描述

给定一个整数 MMNN 对整数 (A1,B1),(A2,B2),,(AN,BN)(A_1, B_1), (A_2, B_2), \dots, (A_N, B_N)。 对于所有 ii,满足条件 1Ai<BiM1 \leq A_i < B_i \leq M

若一个序列 SS 满足以下条件,则称其为 良序序列

  • SS 是序列 (1,2,3,,M)(1,2,3,\dots, M) 的连续子序列。
  • 对于所有 iiSS 至少包含 AiA_iBiB_i 中的一个元素。

f(k)f(k) 表示长度为 kk 的可能良序序列的数量。
请列举出 f(1),f(2),,f(M)f(1), f(2), \dots, f(M) 的值。

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

Problem Statement

You are given an integer MM and NN pairs of integers (A1,B1),(A2,B2),,(AN,BN)(A_1, B_1), (A_2, B_2), \dots, (A_N, B_N).
For all ii, it holds that 1Ai<BiM1 \leq A_i \lt B_i \leq M.

A sequence SS is said to be a good sequence if the following conditions are satisfied:

  • SS is a contiguous subsequence of the sequence (1,2,3,...,M)(1,2,3,..., M).
  • For all ii, SS contains at least one of AiA_i and BiB_i.

Let f(k)f(k) be the number of possible good sequences of length kk.
Enumerate f(1),f(2),,f(M)f(1), f(2), \dots, f(M).

Constraints

  • 1N2×1051 \leq N \leq 2 \times 10^5
  • 2M2×1052 \leq M \leq 2 \times 10^5
  • 1Ai<BiM1 \leq A_i \lt B_i \leq M
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM

A1A_1 B1B_1

A2A_2 B2B_2

\vdots

ANA_N BNB_N

Output

Print the answers in the following format:

f(1)f(1) f(2)f(2) \dots f(M)f(M)

Sample Input 1

3 5
1 3
1 4
2 5

Sample Output 1

0 1 3 2 1

Here is the list of all possible good sequences.

  • (1,2)(1,2)
  • (1,2,3)(1,2,3)
  • (2,3,4)(2,3,4)
  • (3,4,5)(3,4,5)
  • (1,2,3,4)(1,2,3,4)
  • (2,3,4,5)(2,3,4,5)
  • (1,2,3,4,5)(1,2,3,4,5)

Sample Input 2

1 2
1 2

Sample Output 2

2 1

Sample Input 3

5 9
1 5
1 7
5 6
5 8
2 6

Sample Output 3

0 0 1 2 4 4 3 2 1

update @ 2024/3/10 11:01:55