QOJ.ac

QOJ

実行時間制限: 6 s メモリ制限: 2048 MB 満点: 100

#8780. 训练,第二轮

統計

Ashley 正在为 Brandon's Online Judge 上的另一场编程竞赛进行训练。该在线评测系统仍然保留了允许 Ashley 的教练 Tom 为 Ashley 加载题目列表的功能。

Tom 为 Ashley 精选了一些题目。每道题目都有一个“实现难度”范围和一个“思维难度”范围。

Ashley 的初始实现技能水平和思维技能水平是给定的。Ashley 将按照以下方式训练 Tom 精选的题目列表:她会查看列表中的第一道题,并选择解决它或跳过它。然后,她会按照 Tom 加载题目的顺序,对列表中的每一道题重复此过程。一旦她跳过了一道题,就永远无法回头再做。只有当 Ashley 当前的实现技能和思维技能都落在给定题目的范围内(包含边界)时,她才能解决该题。解决一道题后,Ashley 会进行反思,这使她可以将实现技能水平提高 1 点,或者将思维技能水平提高 1 点。她不能同时提高两者,也不能跳过反思过程。

请计算如果 Ashley 能够最优地规划她的反思,她最多能解决多少道题目。

输入格式

输入的第一行包含三个整数 $n$ ($1 \le n \le 5\,000$),$i$ 和 $t$ ($0 \le i, t \le 10^9$),其中 $n$ 是 Tom 给 Ashley 的题目数量,$i$ 是 Ashley 的初始实现技能水平,$t$ 是 Ashley 的初始思维技能水平。

接下来的 $n$ 行,每行包含四个整数 $i_{low}, i_{high}$ ($0 \le i_{low} \le i_{high} \le 2 \cdot 10^9$),$t_{low}, t_{high}$ ($0 \le t_{low} \le t_{high} \le 2 \cdot 10^9$)。每行描述一道题目,其实现难度范围为 $[i_{low}, i_{high}]$,思维难度范围为 $[t_{low}, t_{high}]$,均为闭区间。只有当 Ashley 当前的实现技能水平落在实现难度范围内,且思维技能水平落在思维难度范围内(均包含边界)时,她才能解决该题。

输出格式

输出一个整数,表示如果 Ashley 在每次解题后都能最优地选择反思方式,她所能解决的最大题目数量。

样例

样例输入 1

3 0 0
0 1 0 1
1 1 0 1
1 1 1 1

样例输出 1

3

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.