Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'Hossam has n trainees. He assigned a number a_i for the i -th trainee. A pair of the i -th and j -th ( i neq j ) trainees is called successful if there is an integer x ( x geq 2 ), such that x divides a_i , and x divides a_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! The input consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 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 n ( 2 <= n <= 10^5 ). The second line of each test case contains n integers, the number of each trainee a_1, a_2, ... , a_n ( 1 <= a_i <= 10^9 ). It is guaranteed that the sum of n over all test cases does not exceed 10^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. In the first example, the first trainee and the second trainee make up a successful pair: a_1 = 32, a_2 = 48 , you can choose x = 4 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
184801043 |
Ayush_45 |
C |
Dec. 11, 2022, 5:34 p.m. |
OK |
GNU C++14 |
TESTS |
54 |
499 |
819200 |
|
|
184811014 |
rahat.1722 |
C |
Dec. 11, 2022, 7:03 p.m. |
OK |
GNU C++14 |
TESTS |
61 |
826 |
3993600 |
|
|
184834632 |
Febleaf |
C |
Dec. 12, 2022, 2:06 a.m. |
OK |
GNU C++14 |
TESTS |
74 |
873 |
512000 |
|
|
184811763 |
nicolasalba |
C |
Dec. 11, 2022, 7:08 p.m. |
OK |
GNU C++14 |
TESTS |
62 |
873 |
3993600 |
|
|
184805726 |
_skb_ |
C |
Dec. 11, 2022, 6:36 p.m. |
OK |
GNU C++14 |
TESTS |
55 |
873 |
7270400 |
|
|
184847022 |
Prasanna_Jangali |
C |
Dec. 12, 2022, 5:28 a.m. |
OK |
GNU C++14 |
TESTS |
74 |
889 |
3788800 |
|
|
184828188 |
jdw |
C |
Dec. 11, 2022, 11:10 p.m. |
OK |
GNU C++14 |
TESTS |
74 |
889 |
10956800 |
|
|
184807078 |
RaDsZzz |
C |
Dec. 11, 2022, 6:42 p.m. |
OK |
GNU C++14 |
TESTS |
57 |
904 |
3276800 |
|
|
184838338 |
scau_apr |
C |
Dec. 12, 2022, 3:12 a.m. |
OK |
GNU C++14 |
TESTS |
74 |
904 |
4096000 |
|
|
184842267 |
LNCYZ |
C |
Dec. 12, 2022, 4:15 a.m. |
OK |
GNU C++14 |
TESTS |
74 |
919 |
614400 |
|
|
remove filters
Back to search problems