QOJ.ac

QOJ

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

#469. 等差子序列

统计

给出一个长度为 $N$ 的正整数序列,问是否存在一个长度不小于三的等差子序列。

输入格式

第一行一个正整数 $T$,表示数据组数。

接下来 $T$ 组数据,每组数据第一行一个正整数 $N$,表示序列长度,接下来第二行有 $N$ 个正整数,依次表示序列中的数。

输出格式

对于每组数据,输出单独的一行 YESNO

样例数据

样例 1 输入

3
4
4 3 2 1
2
1 100
5
1 17 9 18 17

样例 1 输出

YES
NO
YES

子任务

对于 $20\%$的数据:$N\le 100$。

对于 $40\%$的数据:$N\le 10^3$。

对于 $100\%$的数据:$1\le T \le 10$,$1\le N\le 2\times 10^4$,序列中的数 $\le 2\times 10^4$。

Discussions

About Discussions

The discussion section is only for posting: Editorials, 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. Submitting multiple issues may cause your account to be banned.
  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.