QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 256 MB 満点: 100

#979. 矿工

統計

矿洞中有 $n$ 种不同的矿物。矿洞可以看作一条坐标轴,第 $i$ 种矿物可以在区间 $[l_i, r_i]$ 内的任意位置开采。

你是一名矿工。每天,工头都会给你分配一个开采矿物的任务。一个任务是一个非空的矿物集合(共有 $2^n - 1$ 种不同的任务),你的目标是收集该集合中的所有矿物。

矿洞中有 $m$ 个安全位置 $a_j$。如果存在一个安全位置 $a_p$,使得在该位置可以开采到任务所需的所有矿物,则称该任务为“简单任务”。

现在,请你计算简单任务的数量。

输入格式

第一行包含两个整数 $n$ 和 $m$ ($1 \le n, m \le 10^5$)。

接下来 $n$ 行,每行包含两个整数 $l_i$ 和 $r_i$ ($1 \le l_i \le r_i \le 10^9$)。

接下来 $m$ 行,每行包含一个整数 $a_j$ ($1 \le a_j \le 10^9$)。

输出格式

输出一行,包含一个整数:简单任务的数量对 $998\,244\,353$ 取模的结果。

样例

输入 1

3 2
7 11
1 5
3 8
4
7

输出 1

5

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.