AT_ndpc2026_q.Union of Intervals

入门

通过率:0%

时间限制:10.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given an integer MM and NN pairs of integers (L1,R1),…,(LN,RN)(L_1, R_1), \dots, (L_N, R_N). For each ii (1≤i≤N1 \leq i \leq N), it holds that 1≤Li≤Ri≤M1 \leq L_i \leq R_i \leq M.

For each K=1,2,…,MK = 1, 2, \dots, M, solve the following problem:

There are 2N2^N possible subsets S⊆{1,2,…,N}S \subseteq \lbrace 1,2,\dots,N\rbrace. Among them, how many satisfy the following condition? Output the answer modulo 998244353998244353.

  • The number of integers mm (1≤m≤M1 \leq m \leq M) satisfying the following condition is exactly KK:
    • There exists an integer i∈Si \in S such that Li≤m≤RiL_i \leq m \leq R_i.

给你一个整数 MM 和 NN 对整数 (L1,R1),…,(LN,RN)(L_1, R_1), \dots, (L_N, R_N)。对每个 ii(1≤i≤N1 \leq i \leq N),满足 1≤Li≤Ri≤M1 \leq L_i \leq R_i \leq M。

对每个 K=1,2,…,MK = 1, 2, \dots, M,求解以下问题:

共有 2N2^N 个可能的子集 S⊆{1,2,…,N}S \subseteq \lbrace 1,2,\dots,N\rbrace。其中,有多少个子集 SS 满足如下条件?将答案对 998244353998244353 取模后输出。

  • 满足如下条件的整数 mm(1≤m≤M1 \leq m \leq M)的个数恰好为 KK:
    • 存在某个整数 i∈Si \in S,使得 Li≤m≤RiL_i \leq m \leq R_i。

输入格式

The input is given from standard input in the following format:

NN MM
L1L_1 R1R_1
L2L_2 R2R_2
⋮\vdots
LNL_N RNR_N

输入从标准输入中按以下格式给出:

NN MM
L1L_1 R1R_1
L2L_2 R2R_2
⋮\vdots
LNL_N RNR_N

输出格式

Print MM lines. On the ii-th line, output the answer for K=iK = i.

输出 MM 行。在第 ii 行中,输出 K=iK = i 时的答案。

输入输出样例

  • 输入#1

    3 4
    1 2
    3 4
    2 4

    输出#1

    0
    2
    2
    3
  • 输入#2

    8 10
    6 10
    1 4
    5 9
    6 8
    1 5
    7 9
    4 6
    4 8

    输出#2

    0
    0
    3
    2
    15
    25
    26
    20
    72
    92

说明/提示

Note

This problem has a very strict memory limit.

Sample 1 Explanation:
When K=1K=1, there are 00 subsets SS that satisfy the condition.
When K=2K=2, there are 22 such subsets: {1},{2}\lbrace 1\rbrace , \lbrace 2\rbrace.
When K=3K=3, there are 22 such subsets: {3},{2,3}\lbrace 3\rbrace , \lbrace 2,3\rbrace.
When K=4K=4, there are 33 such subsets: {1,2},{1,3},{1,2,3}\lbrace 1,2\rbrace , \lbrace 1,3\rbrace , \lbrace 1,2,3\rbrace.

Constraints

  • 1≤N≤20001 \leq N \leq 2000
  • 1≤M≤40001 \leq M \leq 4000
  • 1≤Li≤Ri≤M1 \leq L_i \leq R_i \leq M
  • All input values are integers

注意

本题的内存限制非常严格。

样例 1 解释:
当 K=1K=1 时,满足条件的子集 SS 有 00 个。
当 K=2K=2 时,满足条件的子集有 22 个:{1},{2}\lbrace 1\rbrace , \lbrace 2\rbrace。
当 K=3K=3 时,满足条件的子集有 22 个:{3},{2,3}\lbrace 3\rbrace , \lbrace 2,3\rbrace。
当 K=4K=4 时,满足条件的子集有 33 个:{1,2},{1,3},{1,2,3}\lbrace 1,2\rbrace , \lbrace 1,3\rbrace , \lbrace 1,2,3\rbrace。

限制条件

  • 1≤N≤20001 \leq N \leq 2000
  • 1≤M≤40001 \leq M \leq 4000
  • 1≤Li≤Ri≤M1 \leq L_i \leq R_i \leq M
  • 所有输入值均为整数

输入解题思路,AI测评打分。不知道怎么写?

首页