QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100

#979. 礦工

Statistics

礦坑中有 $n$ 種不同的礦物。礦坑可以被視為一條座標軸,第 $i$ 種礦物可以在範圍 $[l_i, r_i]$ 內的任何位置開採。

你是礦坑中的一名礦工。每天,工頭都會給你一項開採礦物的任務。一項任務是一個由不同礦物組成的非空集合(共有 $2^n - 1$ 種不同的任務),你的目標是收集該集合中的所有礦物。

礦坑中有 $m$ 個安全位置 $a_i$。若且唯若你能選擇一個安全位置 $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_i$ ($1 \le a_i \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.