AT_arc226_a.Meeting Division
普及-
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There are N meetings numbered 1,2,…,N. Meeting i starts at time Si and ends at time Ti.
Takahashi and Aoki are going to assign exactly one of themselves to each meeting as the person in charge. The same person cannot be in charge of two meetings that overlap for a positive length of time. More formally, the same person can be in charge of meetings i and j only if Ti≤Sj or Tj≤Si.
Find the number, modulo 998244353, of ways to assign the people in charge that satisfy the conditions.
有 N 场会议,编号为 1,2,…,N。第 i 场会议在时刻 Si 开始,在时刻 Ti 结束。
高桥和青木将为每场会议恰好指定其中一人作为负责人。同一人不能同时负责两场在时间上存在正长度重叠的会议。更准确地说,同一人可以同时负责会议 i 和会议 j,当且仅当 Ti≤Sj 或 Tj≤Si。
求满足上述条件的负责人分配方案数(对 998244353 取模)。
输入格式
The input is given from Standard Input in the following format:
N
S1 T1
S2 T2
⋮
SN TN
输入从标准输入中按以下格式给出:
N
S1 T1
S2 T2
⋮
SN TN
输出格式
Output the number, modulo 998244353, of ways to assign the people in charge that satisfy the conditions.
输出满足条件的负责人分配方案数对 998244353 取模的结果。
输入输出样例
输入#1
3 1 3 2 4 5 6
输出#1
4
输入#2
3 1 4 2 5 3 6
输出#2
0
说明/提示
Sample 1 Explanation:
The following four assignments satisfy the conditions:
- Takahashi is in charge of meetings 1,3, and Aoki is in charge of meeting 2.
- Takahashi is in charge of meeting 1, and Aoki is in charge of meetings 2,3.
- Takahashi is in charge of meetings 2,3, and Aoki is in charge of meeting 1.
- Takahashi is in charge of meeting 2, and Aoki is in charge of meetings 1,3.
Sample 2 Explanation:
Zero assignments satisfy the conditions.
Constraints
- 1≤N≤3×105
- 1≤Si<Ti≤2N
- S1,T1,S2,T2,…,SN,TN are all different.
- All input values are integers.
样例 1 解释:
以下四种分配方案满足条件:
- 高桥负责会议 1,3,青木负责会议 2。
- 高桥负责会议 1,青木负责会议 2,3。
- 高桥负责会议 2,3,青木负责会议 1。
- 高桥负责会议 2,青木负责会议 1,3。
样例 2 解释:
不存在满足条件的分配方案。
约束条件
- 1≤N≤3×105
- 1≤Si<Ti≤2N
- S1,T1,S2,T2,…,SN,TN 互不相同。
- 所有输入值均为整数。
输入解题思路,AI测评打分。不知道怎么写?