AT_ndpc2026_q.Union of Intervals
入门
通过率:0%
时间限制:10.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given an integer M and N pairs of integers (L1,R1),…,(LN,RN). For each i (1≤i≤N), it holds that 1≤Li≤Ri≤M.
For each K=1,2,…,M, solve the following problem:
There are 2N possible subsets S⊆{1,2,…,N}. Among them, how many satisfy the following condition? Output the answer modulo 998244353.
- The number of integers m (1≤m≤M) satisfying the following condition is exactly K:
- There exists an integer i∈S such that Li≤m≤Ri.
给你一个整数 M 和 N 对整数 (L1,R1),…,(LN,RN)。对每个 i(1≤i≤N),满足 1≤Li≤Ri≤M。
对每个 K=1,2,…,M,求解以下问题:
共有 2N 个可能的子集 S⊆{1,2,…,N}。其中,有多少个子集 S 满足如下条件?将答案对 998244353 取模后输出。
- 满足如下条件的整数 m(1≤m≤M)的个数恰好为 K:
- 存在某个整数 i∈S,使得 Li≤m≤Ri。
输入格式
The input is given from standard input in the following format:
N M
L1 R1
L2 R2
⋮
LN RN
输入从标准输入中按以下格式给出:
N M
L1 R1
L2 R2
⋮
LN RN
输出格式
Print M lines. On the i-th line, output the answer for K=i.
输出 M 行。在第 i 行中,输出 K=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=1, there are 0 subsets S that satisfy the condition.
When K=2, there are 2 such subsets: {1},{2}.
When K=3, there are 2 such subsets: {3},{2,3}.
When K=4, there are 3 such subsets: {1,2},{1,3},{1,2,3}.
Constraints
- 1≤N≤2000
- 1≤M≤4000
- 1≤Li≤Ri≤M
- All input values are integers
注意
本题的内存限制非常严格。
样例 1 解释:
当 K=1 时,满足条件的子集 S 有 0 个。
当 K=2 时,满足条件的子集有 2 个:{1},{2}。
当 K=3 时,满足条件的子集有 2 个:{3},{2,3}。
当 K=4 时,满足条件的子集有 3 个:{1,2},{1,3},{1,2,3}。
限制条件
- 1≤N≤2000
- 1≤M≤4000
- 1≤Li≤Ri≤M
- 所有输入值均为整数
输入解题思路,AI测评打分。不知道怎么写?