Miner
Time limit1sMemory limit256 MB
Given n intervals and m points, count the nonempty subsets of intervals whose intersection contains at least one of the given points, modulo 998244353.
- Level
Hard8 of 10
- Topics
- Intervals, Sorting, Combinatorics, Two pointers
- Solved
- No attempts yet
Problem
There are different minerals in a mine cave. The mine cave can be regarded as a coordinate axis, and the -th mineral can be mined from any position in the range .
You are a miner in this mine cave. On each day, the foreman gives you a task of mining minerals. A task is a non-empty set of different minerals (there are different tasks), and your goal is to collect all minerals in this set.
There are safe positions in the mine cave. A task is easy if and only if you can select a safe position and find all required minerals there.
Now, you want to count the number of easy tasks.
Input
The first line contains two integers and ().
Then lines follow. Each of them contains two integers and ().
Then lines follow. Each of them contains a single integer ().
Output
Output a single line with a single integer: the number of easy tasks modulo .