QOJ.ac

QOJ

時間限制: 2.0 s 記憶體限制: 512 MB 總分: 100

#12314. 四元素

统计

你有一个由 $n$ 个区间 $[l_i, r_i]$ 的并集构成的非负整数集合 $A$。集合 $A$ 中有多少个 4 元子集,其元素之和等于 $s$?请输出该数量对 $998\,244\,353$ 取模的结果。

输入格式

第一行包含两个整数 $n$ 和 $s$ ($1 \le n \le 400$; $0 \le s \le 8 \cdot 10^8$),分别表示区间的数量和目标和。

接下来的 $n$ 行,每行包含两个整数 $l_i$ 和 $r_i$ ($0 \le l_i \le r_i \le 2 \cdot 10^8$; $r_i < l_{i+1}$),表示第 $i$ 个区间的边界。

输出格式

输出集合 $A$ 中和为 $s$ 的 4 元子集的数量,对 $998\,244\,353$ 取模。

样例

输入 1

2 17
1 3
5 8

输出 1

4

说明

在样例测试中,$A = \{1, 2, 3, 5, 6, 7, 8\}$。其和为 $17$ 的 4 元子集有 $\{1, 2, 6, 8\}$、$\{1, 3, 5, 8\}$、$\{1, 3, 6, 7\}$ 和 $\{2, 3, 5, 7\}$。

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#848EditorialOpen题解alpha10222026-01-28 02:21:07View

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.