QOJ.ac

QOJ

実行時間制限: 12.0 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓

#17173. 建筑公司

統計

新年假期结束了,你的建筑公司正在重新开工。不幸的是,一些员工仍在庆祝……

今天,有 $a$ 名清醒的工人和 $b$ 名醉酒的工人来为你工作。每位工人整天都可用。你的公司今天还收到了 $m$ 个订单。每个订单由执行它的时间跨度的起点和终点指定:$[st, fn]$。这样一个订单需要一名工人在从时刻 $st$ 到时刻 $fn$(含两端)的时间段内为其工作。如果多个订单的时间跨度不相交,一名工人可以完成这些订单。此外,每个订单属于以下两种类型之一:简单订单可以由任何工人完成,而复杂订单则需要清醒的工人。

你的公司能否处理今天的订单?

输入格式

第一行包含一个整数 $t$,表示测试用例的数量($1 \le t \le 2000$)。对于每个测试用例:

  • 第一行包含三个整数:$a$、$b$ 和 $m$($0 \le a, b, m \le 10\,000$)。
  • 接下来 $m$ 行。每行包含三个整数 $type$、$st$ 和 $fn$,描述一个时间跨度为 $[st, fn]$ 的简单(若 $type = 1$)或复杂(若 $type = 2$)订单($type \in \{1, 2\}$;$1 \le st \le fn \le 2 \cdot m$)。例如,行 1 2 4 描述了一个简单订单,它需要三个时刻,从第二个时刻到第四个时刻,包含两端。

所有测试用例中 $m$ 的总和不超过 $10\,000$。

输出格式

对于每个测试用例,输出一行包含答案:“Yes” 或 “No”(不区分大小写)。

样例

输入样例 1

1
1 1 2
1 1 2
2 2 4

输出样例 1

Yes

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1224EditorialOpen题解jiangly2026-03-06 01:32:41View

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.