QOJ.ac

QOJ

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

#5645. 走路的男孩

統計

SWERC 的一位评委有一只名叫 Boy 的狗。除了是一位优秀的竞技编程选手外,Boy 还非常热爱新鲜空气,因此她每天至少需要被遛两次。遛 Boy 需要连续 120 分钟。两次遛狗的时间不能重叠,但一次遛狗可以在上一次结束后立即开始。

今天,评委向 SWERC Discord 服务器发送了 $n$ 条消息。第 $i$ 条消息是在午夜后 $a_i$ 分钟发送的。你知道,在遛 Boy 时,评委不会发送任何消息,但他可以在遛狗之前或之后立即发送消息。请问评委今天是否可能至少遛了两次 Boy?

注意,一天有 1440 分钟,如果一次遛狗开始于 $s \ge 0$ 分钟,结束于 $e \le 1440$ 分钟,则认为该次遛狗发生在今天。在这种情况下,必须满足 $e - s = 120$,并且对于每个 $i = 1, 2, \dots, n$,要么 $a_i \le s$,要么 $a_i \ge e$。

输入格式

每个测试包含多个测试用例。第一行包含一个整数 $t$ ($1 \le t \le 100$),表示测试用例的数量。接下来是 $t$ 个测试用例的描述。

每个测试用例的第一行包含一个整数 $n$ ($1 \le n \le 100$),表示评委发送的消息数量。

每个测试用例的第二行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$ ($0 \le a_1 < a_2 < \dots < a_n < 1440$),表示发送消息的时间(以午夜后的分钟数计)。

输出格式

对于每个测试用例,如果 Boy 今天至少被遛了两次是可能的,则输出一行 YES,否则输出 NO

样例

样例输入 1

6
14
100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400
12
100 200 300 400 600 700 800 900 1100 1200 1300 1400
13
100 200 300 400 500 600 700 800 900 1100 1200 1300 1400
13
101 189 272 356 463 563 659 739 979 1071 1170 1274 1358
1
42
5
0 1 2 3 4

样例输出 1

NO
YES
NO
YES
YES
YES

说明

在第一个测试用例中,评委在每个 100 的倍数时刻(不包括 0)都发送了消息。他不可能遛过一次 Boy。

在第二个测试用例中,时间与上述相同,但缺少了 500 和 1000。评委可以在时间间隔 $[440, 560]$ 和 $[980, 1100]$ 内遛 Boy。这种情况如下图所示,其中绿色区间表示遛狗时间。

在第三个测试用例中,时间与第一个测试用例相同,但缺少了 1000。评委最多只能遛一次 Boy。

在第四个测试用例中,Boy 可能在时间间隔 $[739, 859]$ 和 $[859, 979]$ 内被遛。

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.