CF1771C.Hossam and Trainees

普及/提高-

通过率:0%

时间限制:3.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Hossam has nn trainees. He assigned a number aia_i for the ii-th trainee.

A pair of the ii-th and jj-th (i≠ji \neq j) trainees is called successful if there is an integer xx (x≥2x \geq 2), such that xx divides aia_i, and xx divides aja_j.

Hossam wants to know if there is a successful pair of trainees.

Hossam is very tired now, so he asks you for your help!

侯萨姆有 nn 名学员。他为第 ii 名学员分配了一个数 aia_i。

若存在一个整数 xx(x≥2x \geq 2),使得 xx 同时整除 aia_i 和 aja_j,则称第 ii 名与第 jj 名(i≠ji \neq j)学员组成的对为成功对。

侯萨姆想知道是否存在一个成功对。

侯萨姆现在非常疲惫,因此请你帮忙!

输入格式

The input consists of multiple test cases. The first line contains a single integer tt (1≤t≤1051 \le t \le 10^5), the number of test cases. A description of the test cases follows.

The first line of each test case contains an integer number nn (2≤n≤1052 \le n \le 10^5).

The second line of each test case contains nn integers, the number of each trainee a1,a2,…,ana_1, a_2, \dots, a_n (1≤ai≤1091 \le a_i \le 10^9).

It is guaranteed that the sum of nn over all test cases does not exceed 10510^5.

输入包含多个测试用例。第一行包含一个整数 tt(1≤t≤1051 \le t \le 10^5),表示测试用例的数量。随后是各测试用例的描述。

每个测试用例的第一行包含一个整数 nn(2≤n≤1052 \le n \le 10^5)。

每个测试用例的第二行包含 nn 个整数,表示每位学员的编号 a1,a2,…,ana_1, a_2, \dots, a_n(1≤ai≤1091 \le a_i \le 10^9)。

保证所有测试用例的 nn 之和不超过 10510^5。

输出格式

Print the answer — "YES" (without quotes) if there is a successful pair of trainees and "NO" otherwise. You can print each letter in any case.

输出答案——如果存在一对成功的实习生,则输出 “YES”(不带引号);否则输出 “NO”。每个字母的大小写均可。

输入输出样例

  • 输入#1

    2
    3
    32 48 7
    3
    14 5 9

    输出#1

    YES
    NO

说明/提示

In the first example, the first trainee and the second trainee make up a successful pair:

a1=32,a2=48a_1 = 32, a_2 = 48, you can choose x=4x = 4.

在第一个例子中,第一名实习生和第二名实习生组成了一对成功的组合:

a1=32,a2=48a_1 = 32, a_2 = 48,你可以选择 x=4x = 4。

输入解题思路,AI测评打分。不知道怎么写?

首页