QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 128 MB Total points: 10

#6053. Lustra [B]

Statistics

Bajtazar 的公司专门生产带有镜面门的木制衣柜。公司专注于木制品的质量,并将镜子的生产外包给分包商。

Bajtazar 公司刚刚结束了一场招标。共有 $n$ 家工厂参与了投标,每家工厂都提交了一份关于其生产镜子尺寸的报价。所有的镜子均为矩形。每家工厂的报价都给出了其生产镜子的最小宽度、最大宽度、最小高度和最大高度。在衣柜生产过程中,镜子不能旋转。

Bajtazar 知道,如果有一家工厂的报价涵盖了所有其他工厂的报价(即:没有其他任何一家工厂能生产出该工厂无法生产的尺寸的镜子),那么这家工厂肯定会赢得招标(如果有多家工厂的报价都能涵盖所有其他工厂,则报价中每平方厘米镜子价格最低的那家获胜)。否则,对报价的评估将会变得复杂,招标结果的确定也会大大延迟。为了避免无谓的争论,Bajtazar 请你编写一个程序,判断是否有一家工厂的报价涵盖了所有其他工厂的报价。

输入格式

输入的第一行包含一个整数 $t$ ($1 \le t \le 10$),表示需要考虑的测试用例数量。接下来是各测试用例的描述。

每个测试用例的第一行包含一个整数 $n$ ($2 \le n \le 100\,000$),表示参与 Bajtazar 公司招标的镜子生产工厂数量。接下来的 $n$ 行,每行包含四个整数 $w_1, w_2, h_1, h_2$ ($1 \le w_1 \le w_2 \le 10^9$, $1 \le h_1 \le h_2 \le 10^9$)。这些数字表示该工厂可以生产宽度 $w$ 和高度 $h$ 满足 $w_1 \le w \le w_2$ 且 $h_1 \le h \le h_2$ 的任意整数尺寸的镜子。

输出格式

你的程序应输出 $t$ 行,包含各测试用例的答案。在第 $i$ 行中,应输出一个单词 TAK 或 NIE,取决于招标中是否存在一家工厂的报价涵盖了所有其他工厂的报价。

样例

输入 1

3
3
2 3 3 5
1 4 2 6
1 3 4 6
3
1 5 1 3
2 4 1 3
3 4 2 5
4
1 2 1 10
1 2 3 8
2 2 7 10
1 2 1 10

输出 1

TAK
NIE
TAK

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.