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 array a consisting of n positive integers. You have to choose a positive integer d and paint all elements into two colors. All elements which are divisible by d will be painted red, and all other elements will be painted blue. The coloring is called beautiful if there are no pairs of adjacent elements with the same color in the array. Your task is to find any value of d which yields a beautiful coloring, or report that it is impossible. The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of testcases. The first line of each testcase contains one integer n ( 2 <= n <= 100 ) -- the number of elements of the array. The second line of each testcase contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^{18} ). For each testcase print a single integer. If there is no such value of d that yields a beautiful coloring, print 0 . Otherwise, print any suitable value of d ( 1 <= d <= 10^{18} ). '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
139349102 |
ssvb |
C |
Dec. 15, 2021, 3:58 a.m. |
OK |
D |
TESTS |
4 |
46 |
6144000 |
|
|
139346636 |
onnstion49 |
C |
Dec. 15, 2021, 3:01 a.m. |
OK |
GNU C11 |
TESTS |
4 |
46 |
0 |
|
|
139338542 |
Zollo757347 |
C |
Dec. 15, 2021, 1:06 a.m. |
OK |
GNU C11 |
TESTS |
4 |
46 |
0 |
|
|
139305631 |
murali_33 |
C |
Dec. 14, 2021, 4:44 p.m. |
OK |
GNU C11 |
TESTS |
4 |
46 |
1638400 |
|
|
139349059 |
I_check |
C |
Dec. 15, 2021, 3:57 a.m. |
OK |
GNU C++14 |
TESTS |
4 |
30 |
0 |
|
|
139318639 |
thenorthpole |
C |
Dec. 14, 2021, 5:52 p.m. |
OK |
GNU C++14 |
TESTS |
4 |
30 |
0 |
|
|
139313849 |
3BS_AS |
C |
Dec. 14, 2021, 5:10 p.m. |
OK |
GNU C++14 |
TESTS |
4 |
30 |
102400 |
|
|
139311421 |
arnab_sheikh |
C |
Dec. 14, 2021, 4:56 p.m. |
OK |
GNU C++14 |
TESTS |
4 |
30 |
102400 |
|
|
139319893 |
Single_Ready_To_Mingle |
C |
Dec. 14, 2021, 6:06 p.m. |
OK |
GNU C++14 |
TESTS |
4 |
31 |
0 |
|
|
139313481 |
Tanvirrafi |
C |
Dec. 14, 2021, 5:07 p.m. |
OK |
GNU C++14 |
TESTS |
4 |
31 |
0 |
|
|
139312534 |
kuldeepjaiswal0901 |
C |
Dec. 14, 2021, 5:02 p.m. |
OK |
GNU C++14 |
TESTS |
4 |
31 |
0 |
|
|
139354047 |
gcj |
C |
Dec. 15, 2021, 5:21 a.m. |
OK |
GNU C++14 |
TESTS |
4 |
31 |
0 |
|
|
139354670 |
gcj |
C |
Dec. 15, 2021, 5:30 a.m. |
OK |
GNU C++14 |
TESTS |
4 |
31 |
0 |
|
|
139354906 |
PanC_ake |
C |
Dec. 15, 2021, 5:33 a.m. |
OK |
GNU C++14 |
TESTS |
4 |
31 |
0 |
|
|
139313502 |
Arpeit_08 |
C |
Dec. 14, 2021, 5:08 p.m. |
OK |
GNU C++17 |
TESTS |
4 |
30 |
0 |
|
|
139331164 |
tashwas |
C |
Dec. 14, 2021, 8:54 p.m. |
OK |
GNU C++17 |
TESTS |
4 |
30 |
0 |
|
|
139345124 |
jil_patel2105 |
C |
Dec. 15, 2021, 2:21 a.m. |
OK |
GNU C++17 |
TESTS |
4 |
30 |
102400 |
|
|
139316499 |
sritampanda |
C |
Dec. 14, 2021, 5:31 p.m. |
OK |
GNU C++17 |
TESTS |
4 |
30 |
102400 |
|
|
139347399 |
codingBeast_oo7 |
C |
Dec. 15, 2021, 3:20 a.m. |
OK |
GNU C++17 |
TESTS |
4 |
30 |
102400 |
|
|
139319719 |
n_o_n_a_m_e |
C |
Dec. 14, 2021, 6:04 p.m. |
OK |
GNU C++17 |
TESTS |
4 |
31 |
0 |
|
|
139317633 |
aakash.shelake1999 |
C |
Dec. 14, 2021, 5:41 p.m. |
OK |
GNU C++17 |
TESTS |
4 |
31 |
0 |
|
|
139351795 |
gurudevsingh_14 |
C |
Dec. 15, 2021, 4:46 a.m. |
OK |
GNU C++17 |
TESTS |
4 |
31 |
0 |
|
|
139356114 |
Tiglon |
C |
Dec. 15, 2021, 5:50 a.m. |
OK |
GNU C++17 |
TESTS |
4 |
31 |
0 |
|
|
139332142 |
ags6699 |
C |
Dec. 14, 2021, 9:16 p.m. |
OK |
GNU C++17 |
TESTS |
4 |
31 |
0 |
|
|
139312151 |
thang.nguyen30092002 |
C |
Dec. 14, 2021, 5 p.m. |
OK |
GNU C++17 (64) |
TESTS |
4 |
15 |
0 |
|
|
139348974 |
jb_2402 |
C |
Dec. 15, 2021, 3:55 a.m. |
OK |
GNU C++17 (64) |
TESTS |
4 |
15 |
0 |
|
|
139337305 |
fxhd |
C |
Dec. 15, 2021, 12:18 a.m. |
OK |
GNU C++17 (64) |
TESTS |
4 |
15 |
0 |
|
|
139329809 |
abhishek855 |
C |
Dec. 14, 2021, 8:26 p.m. |
OK |
GNU C++17 (64) |
TESTS |
4 |
15 |
0 |
|
|
139336090 |
jt.cheng26_orz |
C |
Dec. 14, 2021, 11:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
4 |
15 |
307200 |
|
|
139326681 |
vk1cd314 |
C |
Dec. 14, 2021, 7:36 p.m. |
OK |
GNU C++17 (64) |
TESTS |
4 |
30 |
0 |
|
|
139327719 |
Amank2854 |
C |
Dec. 14, 2021, 7:52 p.m. |
OK |
GNU C++17 (64) |
TESTS |
4 |
30 |
0 |
|
|
139337397 |
Kidding_Ma |
C |
Dec. 15, 2021, 12:22 a.m. |
OK |
GNU C++17 (64) |
TESTS |
4 |
30 |
0 |
|
|
139337949 |
bkifhr6 |
C |
Dec. 15, 2021, 12:45 a.m. |
OK |
GNU C++17 (64) |
TESTS |
4 |
30 |
0 |
|
|
139351088 |
jigsaw_20 |
C |
Dec. 15, 2021, 4:34 a.m. |
OK |
GNU C++17 (64) |
TESTS |
4 |
30 |
0 |
|
|
139346707 |
Cleanblue |
C |
Dec. 15, 2021, 3:03 a.m. |
OK |
GNU C++20 (64) |
TESTS |
4 |
15 |
0 |
|
|
139339808 |
darkcoder_p2ditya |
C |
Dec. 15, 2021, 1:51 a.m. |
OK |
GNU C++20 (64) |
TESTS |
4 |
15 |
0 |
|
|
139334300 |
kavan02 |
C |
Dec. 14, 2021, 10:14 p.m. |
OK |
GNU C++20 (64) |
TESTS |
4 |
15 |
0 |
|
|
139332764 |
connect_kgp |
C |
Dec. 14, 2021, 9:30 p.m. |
OK |
GNU C++20 (64) |
TESTS |
4 |
15 |
0 |
|
|
139331554 |
RedMACHINE |
C |
Dec. 14, 2021, 9:02 p.m. |
OK |
GNU C++20 (64) |
TESTS |
4 |
15 |
0 |
|
|
139331502 |
mohammadomar |
C |
Dec. 14, 2021, 9:01 p.m. |
OK |
GNU C++20 (64) |
TESTS |
4 |
15 |
0 |
|
|
139356794 |
rebel_404 |
C |
Dec. 15, 2021, 5:59 a.m. |
OK |
GNU C++20 (64) |
TESTS |
4 |
15 |
0 |
|
|
139355127 |
__TLE__ |
C |
Dec. 15, 2021, 5:36 a.m. |
OK |
GNU C++20 (64) |
TESTS |
4 |
15 |
0 |
|
|
139354980 |
heisenberg09 |
C |
Dec. 15, 2021, 5:34 a.m. |
OK |
GNU C++20 (64) |
TESTS |
4 |
15 |
0 |
|
|
139347453 |
schiftyfive4 |
C |
Dec. 15, 2021, 3:21 a.m. |
OK |
GNU C++20 (64) |
TESTS |
4 |
15 |
0 |
|
|
139325248 |
Dmohan |
C |
Dec. 14, 2021, 7:15 p.m. |
OK |
Go |
TESTS |
4 |
124 |
4300800 |
|
|
139312837 |
Halix |
C |
Dec. 14, 2021, 5:04 p.m. |
OK |
Java 11 |
TESTS |
4 |
171 |
0 |
|
|
139328662 |
y_cat |
C |
Dec. 14, 2021, 8:08 p.m. |
OK |
Java 11 |
TESTS |
4 |
202 |
0 |
|
|
139320619 |
_Loopinfility_ |
C |
Dec. 14, 2021, 6:14 p.m. |
OK |
Java 11 |
TESTS |
4 |
202 |
0 |
|
|
139314476 |
suchit_07 |
C |
Dec. 14, 2021, 5:14 p.m. |
OK |
Java 11 |
TESTS |
4 |
202 |
0 |
|
|
139312998 |
himanshu19468 |
C |
Dec. 14, 2021, 5:05 p.m. |
OK |
Java 11 |
TESTS |
4 |
217 |
0 |
|
|
139352923 |
sumitchavan |
C |
Dec. 15, 2021, 5:04 a.m. |
OK |
Java 11 |
TESTS |
4 |
217 |
0 |
|
|
139329360 |
rohanyeahyeah |
C |
Dec. 14, 2021, 8:19 p.m. |
OK |
Java 11 |
TESTS |
4 |
218 |
0 |
|
|
139338845 |
gurkaran_s |
C |
Dec. 15, 2021, 1:17 a.m. |
OK |
Java 11 |
TESTS |
4 |
218 |
0 |
|
|
139328773 |
nishaantrastogi |
C |
Dec. 14, 2021, 8:09 p.m. |
OK |
Java 11 |
TESTS |
4 |
218 |
0 |
|
|
139322053 |
LucunJi |
C |
Dec. 14, 2021, 6:32 p.m. |
OK |
Java 11 |
TESTS |
4 |
218 |
0 |
|
|
139355918 |
tanishq044 |
C |
Dec. 15, 2021, 5:47 a.m. |
OK |
Java 8 |
TESTS |
4 |
109 |
0 |
|
|
139325916 |
aastha.chauhan01 |
C |
Dec. 14, 2021, 7:24 p.m. |
OK |
Java 8 |
TESTS |
4 |
124 |
0 |
|
|
139322934 |
pranavggupta06 |
C |
Dec. 14, 2021, 6:42 p.m. |
OK |
Java 8 |
TESTS |
4 |
124 |
0 |
|
|
139317227 |
dogranmol |
C |
Dec. 14, 2021, 5:37 p.m. |
OK |
Java 8 |
TESTS |
4 |
124 |
0 |
|
|
139305181 |
golions |
C |
Dec. 14, 2021, 4:43 p.m. |
OK |
Java 8 |
TESTS |
4 |
124 |
0 |
|
|
139311344 |
kishan963 |
C |
Dec. 14, 2021, 4:56 p.m. |
OK |
Java 8 |
TESTS |
4 |
124 |
4915200 |
|
|
139306370 |
g906360 |
C |
Dec. 14, 2021, 4:45 p.m. |
OK |
Java 8 |
TESTS |
4 |
139 |
0 |
|
|
139330461 |
msubhojit58 |
C |
Dec. 14, 2021, 8:39 p.m. |
OK |
Java 8 |
TESTS |
4 |
139 |
0 |
|
|
139324974 |
vaibhav_1710 |
C |
Dec. 14, 2021, 7:11 p.m. |
OK |
Java 8 |
TESTS |
4 |
139 |
0 |
|
|
139311646 |
kishan963 |
C |
Dec. 14, 2021, 4:57 p.m. |
OK |
Java 8 |
TESTS |
4 |
139 |
4915200 |
|
|
139349005 |
forest |
C |
Dec. 15, 2021, 3:56 a.m. |
OK |
MS C++ 2017 |
TESTS |
4 |
124 |
0 |
|
|
139315114 |
IvanRozb |
C |
Dec. 14, 2021, 5:19 p.m. |
OK |
MS C++ 2017 |
TESTS |
4 |
139 |
0 |
|
|
139344872 |
Shuai. |
C |
Dec. 15, 2021, 2:12 a.m. |
OK |
MS C++ 2017 |
TESTS |
4 |
140 |
0 |
|
|
139315231 |
IvanRozb |
C |
Dec. 14, 2021, 5:20 p.m. |
OK |
MS C++ 2017 |
TESTS |
4 |
140 |
0 |
|
|
139350166 |
Mysticode |
C |
Dec. 15, 2021, 4:17 a.m. |
OK |
MS C++ 2017 |
TESTS |
4 |
155 |
0 |
|
|
139322057 |
CrashMaster |
C |
Dec. 14, 2021, 6:32 p.m. |
OK |
MS C++ 2017 |
TESTS |
4 |
155 |
0 |
|
|
139305069 |
komalsatwik2002 |
C |
Dec. 14, 2021, 4:43 p.m. |
OK |
MS C++ 2017 |
TESTS |
4 |
171 |
0 |
|
|
139352472 |
darkdulgi |
C |
Dec. 15, 2021, 4:56 a.m. |
OK |
MS C++ 2017 |
TESTS |
4 |
171 |
0 |
|
|
139323889 |
Mysticode |
C |
Dec. 14, 2021, 6:55 p.m. |
OK |
MS C++ 2017 |
TESTS |
4 |
171 |
0 |
|
|
139329455 |
Asteria_GG |
C |
Dec. 14, 2021, 8:21 p.m. |
OK |
PyPy 3 |
TESTS |
4 |
155 |
7475200 |
|
|
139356017 |
charizard07 |
C |
Dec. 15, 2021, 5:48 a.m. |
OK |
PyPy 3 |
TESTS |
4 |
155 |
7680000 |
|
|
139354718 |
saurabhbisht |
C |
Dec. 15, 2021, 5:30 a.m. |
OK |
PyPy 3 |
TESTS |
4 |
171 |
8908800 |
|
|
139313916 |
1_2_3_4_5_9 |
C |
Dec. 14, 2021, 5:10 p.m. |
OK |
PyPy 3 |
TESTS |
4 |
280 |
9318400 |
|
|
139345006 |
wolfram_ |
C |
Dec. 15, 2021, 2:17 a.m. |
OK |
PyPy 3 |
TESTS |
4 |
280 |
9523200 |
|
|
139332066 |
Pheonix23 |
C |
Dec. 14, 2021, 9:15 p.m. |
OK |
PyPy 3 |
TESTS |
4 |
280 |
20684800 |
|
|
139317474 |
armsusman |
C |
Dec. 14, 2021, 5:40 p.m. |
OK |
PyPy 3 |
TESTS |
4 |
296 |
15155200 |
|
|
139351340 |
MILOY |
C |
Dec. 15, 2021, 4:39 a.m. |
OK |
PyPy 3 |
TESTS |
4 |
311 |
17408000 |
|
|
139325190 |
Liberator187 |
C |
Dec. 14, 2021, 7:14 p.m. |
OK |
PyPy 3 |
TESTS |
4 |
326 |
9523200 |
|
|
139333707 |
yusinv |
C |
Dec. 14, 2021, 9:55 p.m. |
OK |
PyPy 3 |
TESTS |
4 |
327 |
10240000 |
|
|
139318600 |
reennn |
C |
Dec. 14, 2021, 5:52 p.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
202 |
7168000 |
|
|
139314492 |
Sir.Alireza |
C |
Dec. 14, 2021, 5:14 p.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
218 |
9523200 |
|
|
139337713 |
DistortedLight |
C |
Dec. 15, 2021, 12:37 a.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
280 |
6656000 |
|
|
139354767 |
raushnn |
C |
Dec. 15, 2021, 5:31 a.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
280 |
6963200 |
|
|
139355687 |
ShiroTenshi |
C |
Dec. 15, 2021, 5:44 a.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
326 |
7065600 |
|
|
139352302 |
Anton_F |
C |
Dec. 15, 2021, 4:54 a.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
342 |
7270400 |
|
|
139329361 |
tyzzi |
C |
Dec. 14, 2021, 8:19 p.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
342 |
7372800 |
|
|
139353341 |
dutt_shouvik |
C |
Dec. 15, 2021, 5:11 a.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
343 |
137113600 |
|
|
139333692 |
plevande |
C |
Dec. 14, 2021, 9:55 p.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
358 |
7577600 |
|
|
139347290 |
ninja_32 |
C |
Dec. 15, 2021, 3:17 a.m. |
OK |
PyPy 3-64 |
TESTS |
4 |
358 |
7680000 |
|
|
139308609 |
CyberSick |
C |
Dec. 14, 2021, 4:48 p.m. |
OK |
Python 3 |
TESTS |
4 |
78 |
204800 |
|
|
139307496 |
ankitaggarwal |
C |
Dec. 14, 2021, 4:47 p.m. |
OK |
Python 3 |
TESTS |
4 |
78 |
204800 |
|
|
139317468 |
apilat |
C |
Dec. 14, 2021, 5:40 p.m. |
OK |
Python 3 |
TESTS |
4 |
93 |
204800 |
|
|
139313618 |
rostoki |
C |
Dec. 14, 2021, 5:08 p.m. |
OK |
Python 3 |
TESTS |
4 |
93 |
4096000 |
|
|
139355359 |
Dr.DRUNKESTEIN |
C |
Dec. 15, 2021, 5:39 a.m. |
OK |
Python 3 |
TESTS |
4 |
109 |
204800 |
|
|
139353745 |
smorodin228 |
C |
Dec. 15, 2021, 5:16 a.m. |
OK |
Python 3 |
TESTS |
4 |
109 |
204800 |
|
|
139314341 |
Spacelessd |
C |
Dec. 14, 2021, 5:13 p.m. |
OK |
Python 3 |
TESTS |
4 |
109 |
204800 |
|
|
139354217 |
shock_wav3 |
C |
Dec. 15, 2021, 5:23 a.m. |
OK |
Python 3 |
TESTS |
4 |
124 |
204800 |
|
|
139325976 |
walborn |
C |
Dec. 14, 2021, 7:25 p.m. |
OK |
Python 3 |
TESTS |
4 |
124 |
204800 |
|
|
139312504 |
yashsarda2002 |
C |
Dec. 14, 2021, 5:02 p.m. |
OK |
Python 3 |
TESTS |
4 |
124 |
204800 |
|
|
139327536 |
sansen |
C |
Dec. 14, 2021, 7:49 p.m. |
OK |
Rust 2021 |
TESTS |
4 |
30 |
4198400 |
|
|
139354191 |
pili |
C |
Dec. 15, 2021, 5:23 a.m. |
OK |
Rust 2021 |
TESTS |
4 |
108 |
0 |
|
|
remove filters
Back to search problems