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'You are given an integer array a of length n . Does there exist an array b consisting of n+1 positive integers such that a_i= gcd (b_i,b_{i+1}) for all i ( 1 <= q i <= q n )? Note that gcd(x, y) denotes the greatest common divisor (GCD) of integers x and y . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= q t <= q 10^5 ). Description of the test cases follows. The first line of each test case contains an integer n ( 1 <= q n <= q 10^5 ) -- the length of the array a . The second line of each test case contains n space-separated integers a_1,a_2, ldots,a_n representing the array a ( 1 <= q a_i <= q 10^4 ). It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, output "YES" if such b exists, otherwise output "NO". You can print each letter in any case (upper or lower). In the first test case, we can take b=[343,343] . In the second test case, one possibility for b is b=[12,8,6] . In the third test case, it can be proved that there does not exist any array b that fulfills all the conditions. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
175437131 |
Fred94 |
B |
Oct. 10, 2022, 4:21 p.m. |
OK |
C# 10 |
TESTS |
22 |
61 |
6144000 |
|
|
175490796 |
chrisfcoder |
B |
Oct. 11, 2022, 2:26 a.m. |
OK |
C# 10 |
TESTS |
22 |
124 |
6246400 |
|
|
175484681 |
FatalityNT |
B |
Oct. 10, 2022, 11:55 p.m. |
OK |
C# 8 |
TESTS |
22 |
93 |
5632000 |
|
|
175485550 |
FatalityNT |
B |
Oct. 11, 2022, 12:23 a.m. |
OK |
C# 8 |
TESTS |
22 |
93 |
5632000 |
|
|
175497126 |
tjxjx |
B |
Oct. 11, 2022, 4:23 a.m. |
OK |
GNU C11 |
TESTS |
22 |
31 |
1638400 |
|
|
175497969 |
tjxjx |
B |
Oct. 11, 2022, 4:37 a.m. |
OK |
GNU C11 |
TESTS |
22 |
46 |
819200 |
|
|
175490136 |
alan10086 |
B |
Oct. 11, 2022, 2:14 a.m. |
OK |
GNU C++14 |
TESTS |
22 |
15 |
819200 |
|
|
175456303 |
amanr_48 |
B |
Oct. 10, 2022, 6:38 p.m. |
OK |
GNU C++14 |
TESTS |
22 |
15 |
1228800 |
|
|
175487846 |
glorious_dream |
B |
Oct. 11, 2022, 1:25 a.m. |
OK |
GNU C++14 |
TESTS |
22 |
15 |
1638400 |
|
|
175436904 |
orested |
B |
Oct. 10, 2022, 4:21 p.m. |
OK |
GNU C++14 |
TESTS |
22 |
30 |
409600 |
|
|
175459911 |
sushant4452 |
B |
Oct. 10, 2022, 7:20 p.m. |
OK |
GNU C++14 |
TESTS |
22 |
30 |
819200 |
|
|
175479870 |
vyshnavchayi |
B |
Oct. 10, 2022, 9:35 p.m. |
OK |
GNU C++14 |
TESTS |
22 |
30 |
819200 |
|
|
175491430 |
DGJG |
B |
Oct. 11, 2022, 2:38 a.m. |
OK |
GNU C++14 |
TESTS |
22 |
30 |
819200 |
|
|
175487593 |
Iam1789 |
B |
Oct. 11, 2022, 1:19 a.m. |
OK |
GNU C++14 |
TESTS |
22 |
30 |
1638400 |
|
|
175501723 |
Gordon_Z |
B |
Oct. 11, 2022, 5:30 a.m. |
OK |
GNU C++14 |
TESTS |
22 |
31 |
409600 |
|
|
175503404 |
hereiszd erluer |
B |
Oct. 11, 2022, 5:51 a.m. |
OK |
GNU C++14 |
TESTS |
22 |
31 |
409600 |
|
|
175455543 |
mafailure |
B |
Oct. 10, 2022, 6:31 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
15 |
409600 |
|
|
175482052 |
DiaaBadr |
B |
Oct. 10, 2022, 10:26 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
15 |
409600 |
|
|
175492629 |
acwing_meow |
B |
Oct. 11, 2022, 3 a.m. |
OK |
GNU C++17 |
TESTS |
22 |
15 |
819200 |
|
|
175454228 |
abdallahmontaser |
B |
Oct. 10, 2022, 6:18 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
15 |
819200 |
|
|
175440861 |
fyasla |
B |
Oct. 10, 2022, 4:30 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
15 |
1331200 |
|
|
175447381 |
ritik_07 |
B |
Oct. 10, 2022, 5:23 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
15 |
1536000 |
|
|
175482039 |
Belphy |
B |
Oct. 10, 2022, 10:26 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
15 |
2048000 |
|
|
175447990 |
Ab.Mahin |
B |
Oct. 10, 2022, 5:27 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
15 |
2457600 |
|
|
175486186 |
PaperCloud |
B |
Oct. 11, 2022, 12:43 a.m. |
OK |
GNU C++17 |
TESTS |
22 |
15 |
3584000 |
|
|
175481464 |
zuperduper |
B |
Oct. 10, 2022, 10:08 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
30 |
409600 |
|
|
175498255 |
Adham_Ali |
B |
Oct. 11, 2022, 4:42 a.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
15 |
409600 |
|
|
175481061 |
SaadOoN |
B |
Oct. 10, 2022, 10 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
15 |
409600 |
|
|
175454695 |
Lentik_proger |
B |
Oct. 10, 2022, 6:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
15 |
409600 |
|
|
175499554 |
yaoveil |
B |
Oct. 11, 2022, 5:01 a.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
15 |
819200 |
|
|
175488646 |
izumiQR |
B |
Oct. 11, 2022, 1:42 a.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
15 |
819200 |
|
|
175454142 |
KodeReload |
B |
Oct. 10, 2022, 6:17 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
15 |
819200 |
|
|
175448776 |
YeYeYe |
B |
Oct. 10, 2022, 5:32 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
15 |
819200 |
|
|
175452621 |
sajin10 |
B |
Oct. 10, 2022, 6:05 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
15 |
1638400 |
|
|
175479941 |
violent_vigilante |
B |
Oct. 10, 2022, 9:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
15 |
1638400 |
|
|
175486918 |
Irisu |
B |
Oct. 11, 2022, 1:02 a.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
15 |
2764800 |
|
|
175493170 |
VES. |
B |
Oct. 11, 2022, 3:09 a.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
15 |
409600 |
|
|
175491276 |
LCN_ |
B |
Oct. 11, 2022, 2:35 a.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
15 |
409600 |
|
|
175488520 |
HSABOVE |
B |
Oct. 11, 2022, 1:39 a.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
15 |
409600 |
|
|
175488221 |
_BottomCoder_ |
B |
Oct. 11, 2022, 1:32 a.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
15 |
409600 |
|
|
175487576 |
normankr07 |
B |
Oct. 11, 2022, 1:18 a.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
15 |
409600 |
|
|
175486613 |
nlog |
B |
Oct. 11, 2022, 12:54 a.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
15 |
409600 |
|
|
175485639 |
Summer_Water |
B |
Oct. 11, 2022, 12:26 a.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
15 |
409600 |
|
|
175485208 |
Nakamiya |
B |
Oct. 11, 2022, 12:13 a.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
15 |
409600 |
|
|
175498873 |
little_caidd |
B |
Oct. 11, 2022, 4:51 a.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
15 |
409600 |
|
|
175496209 |
Coldarra1 |
B |
Oct. 11, 2022, 4:08 a.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
15 |
409600 |
|
|
175451297 |
koqo |
B |
Oct. 10, 2022, 5:53 p.m. |
OK |
Go |
TESTS |
22 |
31 |
1433600 |
|
|
175447852 |
koqo |
B |
Oct. 10, 2022, 5:26 p.m. |
OK |
Go |
TESTS |
22 |
31 |
2150400 |
|
|
175442438 |
mtarunsai1999 |
B |
Oct. 10, 2022, 4:33 p.m. |
OK |
Go |
TESTS |
22 |
46 |
2150400 |
|
|
175464328 |
doomhammer. |
B |
Oct. 10, 2022, 8:20 p.m. |
OK |
Java 11 |
TESTS |
22 |
171 |
0 |
|
|
175460643 |
deepaksach |
B |
Oct. 10, 2022, 7:29 p.m. |
OK |
Java 11 |
TESTS |
22 |
171 |
0 |
|
|
175454752 |
jyoti360 |
B |
Oct. 10, 2022, 6:23 p.m. |
OK |
Java 11 |
TESTS |
22 |
171 |
0 |
|
|
175454258 |
dunkingdonuts |
B |
Oct. 10, 2022, 6:18 p.m. |
OK |
Java 11 |
TESTS |
22 |
171 |
0 |
|
|
175452819 |
rajneesh.osho |
B |
Oct. 10, 2022, 6:06 p.m. |
OK |
Java 11 |
TESTS |
22 |
171 |
0 |
|
|
175466785 |
AyushS_cg170 |
B |
Oct. 10, 2022, 9 p.m. |
OK |
Java 11 |
TESTS |
22 |
186 |
0 |
|
|
175495528 |
__Serendipity |
B |
Oct. 11, 2022, 3:54 a.m. |
OK |
Java 11 |
TESTS |
22 |
186 |
0 |
|
|
175495470 |
ilasiawo |
B |
Oct. 11, 2022, 3:53 a.m. |
OK |
Java 11 |
TESTS |
22 |
186 |
0 |
|
|
175490866 |
aditya2024 |
B |
Oct. 11, 2022, 2:27 a.m. |
OK |
Java 11 |
TESTS |
22 |
186 |
0 |
|
|
175461323 |
amanpatel23 |
B |
Oct. 10, 2022, 7:38 p.m. |
OK |
Java 11 |
TESTS |
22 |
187 |
0 |
|
|
175494522 |
abdulazizms |
B |
Oct. 11, 2022, 3:34 a.m. |
OK |
Java 17 |
TESTS |
22 |
202 |
3788800 |
|
|
175461212 |
papaAryan |
B |
Oct. 10, 2022, 7:36 p.m. |
OK |
Java 17 |
TESTS |
22 |
327 |
409600 |
|
|
175493505 |
cute_bei |
B |
Oct. 11, 2022, 3:15 a.m. |
OK |
Java 17 |
TESTS |
22 |
342 |
614400 |
|
|
175494706 |
coderev_12 |
B |
Oct. 11, 2022, 3:38 a.m. |
OK |
Java 17 |
TESTS |
22 |
342 |
921600 |
|
|
175501369 |
frey4 |
B |
Oct. 11, 2022, 5:25 a.m. |
OK |
Java 8 |
TESTS |
22 |
93 |
0 |
|
|
175451841 |
vaibhav_1710 |
B |
Oct. 10, 2022, 5:58 p.m. |
OK |
Java 8 |
TESTS |
22 |
108 |
0 |
|
|
175449275 |
Amandubey007 |
B |
Oct. 10, 2022, 5:36 p.m. |
OK |
Java 8 |
TESTS |
22 |
108 |
0 |
|
|
175499103 |
anshulchou_123 |
B |
Oct. 11, 2022, 4:55 a.m. |
OK |
Java 8 |
TESTS |
22 |
109 |
0 |
|
|
175496084 |
cc4414 |
B |
Oct. 11, 2022, 4:05 a.m. |
OK |
Java 8 |
TESTS |
22 |
109 |
0 |
|
|
175495420 |
aryaman_571 |
B |
Oct. 11, 2022, 3:52 a.m. |
OK |
Java 8 |
TESTS |
22 |
109 |
0 |
|
|
175489655 |
kevinqaq |
B |
Oct. 11, 2022, 2:04 a.m. |
OK |
Java 8 |
TESTS |
22 |
109 |
0 |
|
|
175465127 |
osa.ayman |
B |
Oct. 10, 2022, 8:33 p.m. |
OK |
Java 8 |
TESTS |
22 |
109 |
0 |
|
|
175460913 |
Unrated_Pritam |
B |
Oct. 10, 2022, 7:32 p.m. |
OK |
Java 8 |
TESTS |
22 |
109 |
0 |
|
|
175447353 |
Otepbergen |
B |
Oct. 10, 2022, 5:23 p.m. |
OK |
Java 8 |
TESTS |
22 |
109 |
0 |
|
|
175502852 |
liaopengfei |
B |
Oct. 11, 2022, 5:44 a.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
46 |
409600 |
|
|
175491290 |
lxk_iKun |
B |
Oct. 11, 2022, 2:35 a.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
62 |
819200 |
|
|
175484923 |
tjdvyzl12345 |
B |
Oct. 11, 2022, 12:04 a.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
62 |
1638400 |
|
|
175486435 |
tjdvyzl12345 |
B |
Oct. 11, 2022, 12:50 a.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
77 |
819200 |
|
|
175492682 |
kun2605879979 |
B |
Oct. 11, 2022, 3:01 a.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
77 |
16076800 |
|
|
175495533 |
sneak_rasengan |
B |
Oct. 11, 2022, 3:54 a.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
78 |
819200 |
|
|
175489661 |
lxk_iKun |
B |
Oct. 11, 2022, 2:04 a.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
78 |
819200 |
|
|
175436269 |
OmarRnr |
B |
Oct. 10, 2022, 4:19 p.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
78 |
1536000 |
|
|
175484421 |
turz0ahsan |
B |
Oct. 10, 2022, 11:47 p.m. |
OK |
Node.js |
TESTS |
22 |
78 |
2867200 |
|
|
175488334 |
rummansadik |
B |
Oct. 11, 2022, 1:35 a.m. |
OK |
PyPy 3 |
TESTS |
22 |
109 |
6860800 |
|
|
175490885 |
Yash_Nandwana |
B |
Oct. 11, 2022, 2:28 a.m. |
OK |
PyPy 3 |
TESTS |
22 |
156 |
8089600 |
|
|
175457191 |
phantomxxx |
B |
Oct. 10, 2022, 6:48 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
171 |
6963200 |
|
|
175459384 |
zapdospops |
B |
Oct. 10, 2022, 7:14 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
217 |
6553600 |
|
|
175463050 |
sheshank10 |
B |
Oct. 10, 2022, 8:01 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
217 |
6963200 |
|
|
175466274 |
aneesh2002 |
B |
Oct. 10, 2022, 8:51 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
233 |
7475200 |
|
|
175466665 |
Noureldin |
B |
Oct. 10, 2022, 8:58 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
233 |
11264000 |
|
|
175494541 |
lemoon_05 |
B |
Oct. 11, 2022, 3:35 a.m. |
OK |
PyPy 3 |
TESTS |
22 |
234 |
7168000 |
|
|
175455153 |
Mark2012 |
B |
Oct. 10, 2022, 6:27 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
249 |
10240000 |
|
|
175461903 |
rajbunsha |
B |
Oct. 10, 2022, 7:46 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
342 |
10547200 |
|
|
175447408 |
riroan |
B |
Oct. 10, 2022, 5:23 p.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
92 |
15155200 |
|
|
175452768 |
jaglike_makkar |
B |
Oct. 10, 2022, 6:06 p.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
93 |
9318400 |
|
|
175496295 |
griffindor |
B |
Oct. 11, 2022, 4:09 a.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
93 |
13004800 |
|
|
175496282 |
PVR11 |
B |
Oct. 11, 2022, 4:09 a.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
93 |
13619200 |
|
|
175446524 |
beethoven97 |
B |
Oct. 10, 2022, 5:19 p.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
93 |
13619200 |
|
|
175493698 |
bokunopicolo |
B |
Oct. 11, 2022, 3:19 a.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
93 |
13721600 |
|
|
175449547 |
abineth |
B |
Oct. 10, 2022, 5:38 p.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
93 |
14848000 |
|
|
175450368 |
IndexError |
B |
Oct. 10, 2022, 5:45 p.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
108 |
13721600 |
|
|
175491024 |
sdt4936 |
B |
Oct. 11, 2022, 2:30 a.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
108 |
14745600 |
|
|
175495921 |
valentk777 |
B |
Oct. 11, 2022, 4:02 a.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
109 |
13926400 |
|
|
175449942 |
meohenbk |
B |
Oct. 10, 2022, 5:41 p.m. |
OK |
Python 3 |
TESTS |
22 |
93 |
2150400 |
|
|
175439962 |
pravallika_pravs |
B |
Oct. 10, 2022, 4:28 p.m. |
OK |
Python 3 |
TESTS |
22 |
108 |
1638400 |
|
|
175451365 |
alaa81313 |
B |
Oct. 10, 2022, 5:54 p.m. |
OK |
Python 3 |
TESTS |
22 |
108 |
1945600 |
|
|
175485245 |
milimurmu1995 |
B |
Oct. 11, 2022, 12:14 a.m. |
OK |
Python 3 |
TESTS |
22 |
109 |
1945600 |
|
|
175456861 |
fnoaman |
B |
Oct. 10, 2022, 6:44 p.m. |
OK |
Python 3 |
TESTS |
22 |
109 |
1945600 |
|
|
175485503 |
happywater |
B |
Oct. 11, 2022, 12:22 a.m. |
OK |
Python 3 |
TESTS |
22 |
124 |
1433600 |
|
|
175467485 |
Cuellius |
B |
Oct. 10, 2022, 9:14 p.m. |
OK |
Python 3 |
TESTS |
22 |
124 |
1638400 |
|
|
175448097 |
0xc0ffee |
B |
Oct. 10, 2022, 5:28 p.m. |
OK |
Python 3 |
TESTS |
22 |
124 |
1945600 |
|
|
175486645 |
cr7ro |
B |
Oct. 11, 2022, 12:55 a.m. |
OK |
Python 3 |
TESTS |
22 |
124 |
2048000 |
|
|
175467373 |
Cuellius |
B |
Oct. 10, 2022, 9:11 p.m. |
OK |
Python 3 |
TESTS |
22 |
124 |
2252800 |
|
|
175502964 |
liut |
B |
Oct. 11, 2022, 5:46 a.m. |
OK |
Rust 2021 |
TESTS |
22 |
31 |
409600 |
|
|
175462081 |
avnyu |
B |
Oct. 10, 2022, 7:48 p.m. |
OK |
Rust 2021 |
TESTS |
22 |
31 |
6656000 |
|
|
remove filters
Back to search problems