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$ を選択し、その位置ですべての必要な鉱物を見つけることができる場合、かつその場合に限る。

今、あなたは「簡単」なタスクの数を数えたい。

入力

1行目に2つの整数 $n$ と $m$ ($1 \le n, m \le 10^5$) が与えられる。

続く $n$ 行には、それぞれ2つの整数 $l_i$ と $r_i$ ($1 \le l_i \le r_i \le 10^9$) が与えられる。

続く $m$ 行には、それぞれ1つの整数 $a_i$ ($1 \le a_i \le 10^9$) が与えられる。

出力

「簡単」なタスクの数を $998\,244\,353$ で割った余りを1行で出力せよ。

入出力例

入力 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.