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'Vlad was given an array a of n positive integers. Now he wants to build a beautiful array b of length n from it. Vlad considers an array beautiful if all the numbers in it are positive and have the same parity. That is, all numbers in the beautiful array are greater than zero and are either all even or all odd. To build the array b , Vlad can assign each b_i either the value a_i or a_i - a_j , where any j from 1 to n can be chosen. To avoid trying to do the impossible, Vlad asks you to determine whether it is possible to build a beautiful array b of length n using his array a . The first line of input contains an integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Then follow the descriptions of the test cases. The first line of each case contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the length of the array a . The second line of each case contains n positive integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^9 ) -- the elements of the array a . It is guaranteed that the sum of n over all cases does not exceed 2 cdot 10^5 . Output t strings, each of which is the answer to the corresponding test case. As the answer, output "YES" if Vlad can build a beautiful array b , and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
206540673 |
KLU_30153 |
C |
May 19, 2023, 4:44 p.m. |
OK |
C# 10 |
TESTS |
8 |
77 |
15872000 |
|
|
206542102 |
sumanthsreeram31750 |
C |
May 19, 2023, 4:47 p.m. |
OK |
C# 10 |
TESTS |
8 |
77 |
23756800 |
|
|
206538304 |
nalluriprasanth |
C |
May 19, 2023, 4:38 p.m. |
OK |
C# 10 |
TESTS |
8 |
78 |
15872000 |
|
|
206575531 |
mban259 |
C |
May 19, 2023, 11:44 p.m. |
OK |
C# 10 |
TESTS |
15 |
108 |
22220800 |
|
|
206567896 |
sysadmin |
C |
May 19, 2023, 8:20 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
15 |
124 |
0 |
|
|
206572753 |
aditya_sharma2412 |
C |
May 19, 2023, 10:10 p.m. |
OK |
Clang++20 Diagnostics |
TESTS |
15 |
889 |
0 |
|
|
206573061 |
aditya_sharma2412 |
C |
May 19, 2023, 10:20 p.m. |
OK |
Clang++20 Diagnostics |
TESTS |
15 |
967 |
9420800 |
|
|
206546977 |
hnust_zhouwenjie |
C |
May 19, 2023, 5:05 p.m. |
OK |
GNU C11 |
TESTS |
8 |
46 |
819200 |
|
|
206535610 |
greatguys |
C |
May 19, 2023, 4:32 p.m. |
OK |
GNU C11 |
TESTS |
8 |
46 |
819200 |
|
|
206535648 |
siddiq0611 |
C |
May 19, 2023, 4:32 p.m. |
OK |
GNU C11 |
TESTS |
8 |
46 |
819200 |
|
|
206542053 |
schrodingersmile |
C |
May 19, 2023, 4:47 p.m. |
OK |
GNU C11 |
TESTS |
8 |
46 |
819200 |
|
|
206540775 |
cugnanggu |
C |
May 19, 2023, 4:44 p.m. |
OK |
GNU C11 |
TESTS |
8 |
46 |
1638400 |
|
|
206571476 |
baldron |
C |
May 19, 2023, 9:36 p.m. |
OK |
GNU C11 |
TESTS |
15 |
61 |
819200 |
|
|
206566357 |
iffatul_anon |
C |
May 19, 2023, 7:59 p.m. |
OK |
GNU C11 |
TESTS |
15 |
62 |
0 |
|
|
206534543 |
walidswadhin |
C |
May 19, 2023, 4:30 p.m. |
OK |
GNU C11 |
TESTS |
8 |
62 |
819200 |
|
|
206541030 |
xtu_hgx |
C |
May 19, 2023, 4:44 p.m. |
OK |
GNU C11 |
TESTS |
8 |
62 |
819200 |
|
|
206537277 |
Subham-Maurya |
C |
May 19, 2023, 4:36 p.m. |
OK |
GNU C11 |
TESTS |
8 |
62 |
1638400 |
|
|
206535952 |
doitwithcod3 |
C |
May 19, 2023, 4:33 p.m. |
OK |
GNU C++14 |
TESTS |
8 |
46 |
819200 |
|
|
206576652 |
Ice_teapoy |
C |
May 20, 2023, 12:27 a.m. |
OK |
GNU C++14 |
TESTS |
15 |
46 |
3993600 |
|
|
206537159 |
Akif_Shaharier24 |
C |
May 19, 2023, 4:36 p.m. |
OK |
GNU C++14 |
TESTS |
8 |
61 |
0 |
|
|
206535138 |
Sachin_nsut |
C |
May 19, 2023, 4:31 p.m. |
OK |
GNU C++14 |
TESTS |
8 |
61 |
819200 |
|
|
206554469 |
AhmedSamir13597 |
C |
May 19, 2023, 5:38 p.m. |
OK |
GNU C++14 |
TESTS |
10 |
62 |
0 |
|
|
206545442 |
vivk |
C |
May 19, 2023, 4:56 p.m. |
OK |
GNU C++14 |
TESTS |
8 |
62 |
0 |
|
|
206543787 |
BBS_P |
C |
May 19, 2023, 4:49 p.m. |
OK |
GNU C++14 |
TESTS |
8 |
62 |
0 |
|
|
206570109 |
V_Gosain |
C |
May 19, 2023, 9:03 p.m. |
OK |
GNU C++14 |
TESTS |
15 |
62 |
819200 |
|
|
206574396 |
hamdy301070 |
C |
May 19, 2023, 11:03 p.m. |
OK |
GNU C++14 |
TESTS |
15 |
62 |
819200 |
|
|
206576569 |
Kizk |
C |
May 20, 2023, 12:24 a.m. |
OK |
GNU C++14 |
TESTS |
15 |
62 |
819200 |
|
|
206536996 |
a_bad_apple |
C |
May 19, 2023, 4:35 p.m. |
OK |
GNU C++17 |
TESTS |
8 |
46 |
1536000 |
|
|
206573507 |
Mgs444654 |
C |
May 19, 2023, 10:33 p.m. |
OK |
GNU C++17 |
TESTS |
15 |
46 |
3174400 |
|
|
206558558 |
falak_singla |
C |
May 19, 2023, 6:19 p.m. |
OK |
GNU C++17 |
TESTS |
10 |
61 |
0 |
|
|
206569322 |
Norge_Rubio |
C |
May 19, 2023, 8:47 p.m. |
OK |
GNU C++17 |
TESTS |
15 |
61 |
819200 |
|
|
206575882 |
alpy123 |
C |
May 19, 2023, 11:58 p.m. |
OK |
GNU C++17 |
TESTS |
15 |
61 |
819200 |
|
|
206573310 |
adelian |
C |
May 19, 2023, 10:27 p.m. |
OK |
GNU C++17 |
TESTS |
15 |
61 |
819200 |
|
|
206572115 |
Sherif804 |
C |
May 19, 2023, 9:53 p.m. |
OK |
GNU C++17 |
TESTS |
15 |
61 |
819200 |
|
|
206564228 |
ehab_rafat |
C |
May 19, 2023, 7:28 p.m. |
OK |
GNU C++17 |
TESTS |
10 |
61 |
819200 |
|
|
206564203 |
Hosen_ba |
C |
May 19, 2023, 7:28 p.m. |
OK |
GNU C++17 |
TESTS |
10 |
61 |
819200 |
|
|
206560162 |
stonecode |
C |
May 19, 2023, 6:36 p.m. |
OK |
GNU C++17 |
TESTS |
10 |
61 |
819200 |
|
|
206555463 |
Krzychuo |
C |
May 19, 2023, 5:48 p.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
31 |
819200 |
|
|
206569931 |
Mohit. |
C |
May 19, 2023, 9 p.m. |
OK |
GNU C++17 (64) |
TESTS |
15 |
31 |
1638400 |
|
|
206562058 |
Ahmed_Salah |
C |
May 19, 2023, 7 p.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
46 |
819200 |
|
|
206561946 |
teruel |
C |
May 19, 2023, 6:58 p.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
46 |
819200 |
|
|
206557059 |
Rakib03 |
C |
May 19, 2023, 6:03 p.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
46 |
819200 |
|
|
206554738 |
Sunny004 |
C |
May 19, 2023, 5:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
46 |
819200 |
|
|
206553007 |
lbj1723265730 |
C |
May 19, 2023, 5:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
46 |
819200 |
|
|
206538230 |
youmi_45 |
C |
May 19, 2023, 4:38 p.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
46 |
819200 |
|
|
206544765 |
ykodwani01 |
C |
May 19, 2023, 4:53 p.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
46 |
819200 |
|
|
206575610 |
enslaved |
C |
May 19, 2023, 11:47 p.m. |
OK |
GNU C++17 (64) |
TESTS |
15 |
46 |
819200 |
|
|
206545868 |
Vassu05 |
C |
May 19, 2023, 4:58 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
30 |
1638400 |
|
|
206550197 |
The_Ahmed |
C |
May 19, 2023, 5:15 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
31 |
0 |
|
|
206553819 |
TarunAga |
C |
May 19, 2023, 5:32 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
31 |
0 |
|
|
206559763 |
.titarenko. |
C |
May 19, 2023, 6:31 p.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
31 |
0 |
|
|
206560916 |
Parthib_Nita |
C |
May 19, 2023, 6:46 p.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
31 |
0 |
|
|
206560979 |
XaRDKoDblCH |
C |
May 19, 2023, 6:47 p.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
31 |
0 |
|
|
206564959 |
DevP28 |
C |
May 19, 2023, 7:38 p.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
31 |
0 |
|
|
206570842 |
Savoura |
C |
May 19, 2023, 9:21 p.m. |
OK |
GNU C++20 (64) |
TESTS |
15 |
31 |
0 |
|
|
206577155 |
sinovercos |
C |
May 20, 2023, 12:45 a.m. |
OK |
GNU C++20 (64) |
TESTS |
15 |
31 |
0 |
|
|
206577924 |
DommeUse |
C |
May 20, 2023, 1:07 a.m. |
OK |
GNU C++20 (64) |
TESTS |
15 |
31 |
0 |
|
|
206557717 |
vijender_8601 |
C |
May 19, 2023, 6:10 p.m. |
OK |
Java 11 |
TESTS |
10 |
218 |
0 |
|
|
206574991 |
hornedfoe |
C |
May 19, 2023, 11:23 p.m. |
OK |
Java 11 |
TESTS |
15 |
233 |
0 |
|
|
206546849 |
raghavmcs1 |
C |
May 19, 2023, 5:04 p.m. |
OK |
Java 11 |
TESTS |
8 |
233 |
0 |
|
|
206541476 |
Abdelrahman.Salah |
C |
May 19, 2023, 4:45 p.m. |
OK |
Java 11 |
TESTS |
8 |
248 |
0 |
|
|
206536634 |
saksham_goel05 |
C |
May 19, 2023, 4:34 p.m. |
OK |
Java 11 |
TESTS |
8 |
280 |
0 |
|
|
206566898 |
imvivekthakur |
C |
May 19, 2023, 8:07 p.m. |
OK |
Java 11 |
TESTS |
15 |
311 |
18022400 |
|
|
206552673 |
pxhero |
C |
May 19, 2023, 5:22 p.m. |
OK |
Java 11 |
TESTS |
8 |
373 |
10444800 |
|
|
206547777 |
_nirjhor |
C |
May 19, 2023, 5:10 p.m. |
OK |
Java 11 |
TESTS |
8 |
436 |
0 |
|
|
206540742 |
Programata |
C |
May 19, 2023, 4:44 p.m. |
OK |
Java 11 |
TESTS |
8 |
436 |
0 |
|
|
206540443 |
vladislav_perchun_113 |
C |
May 19, 2023, 4:43 p.m. |
OK |
Java 11 |
TESTS |
8 |
436 |
0 |
|
|
206578141 |
humwawe |
C |
May 20, 2023, 1:14 a.m. |
OK |
Java 17 |
TESTS |
15 |
202 |
512000 |
|
|
206556191 |
m_a_s_91 |
C |
May 19, 2023, 5:55 p.m. |
OK |
Java 17 |
TESTS |
10 |
249 |
204800 |
|
|
206574854 |
Mostafa_Murad |
C |
May 19, 2023, 11:18 p.m. |
OK |
Java 17 |
TESTS |
15 |
295 |
4505600 |
|
|
206573760 |
kamranm |
C |
May 19, 2023, 10:41 p.m. |
OK |
Java 17 |
TESTS |
15 |
295 |
207360000 |
|
|
206536220 |
ramm2413 |
C |
May 19, 2023, 4:33 p.m. |
OK |
Java 17 |
TESTS |
8 |
342 |
819200 |
|
|
206567272 |
Eslam_Ahmed |
C |
May 19, 2023, 8:13 p.m. |
OK |
Java 17 |
TESTS |
15 |
468 |
19865600 |
|
|
206535578 |
arpit900shukla |
C |
May 19, 2023, 4:32 p.m. |
OK |
Java 17 |
TESTS |
8 |
498 |
512000 |
|
|
206559669 |
meghaa7 |
C |
May 19, 2023, 6:30 p.m. |
OK |
Java 17 |
TESTS |
10 |
514 |
716800 |
|
|
206560501 |
anubhavRoy_1305 |
C |
May 19, 2023, 6:40 p.m. |
OK |
Java 17 |
TESTS |
10 |
514 |
716800 |
|
|
206536186 |
serdahsufyan |
C |
May 19, 2023, 4:33 p.m. |
OK |
Java 17 |
TESTS |
8 |
514 |
716800 |
|
|
206561625 |
formidablechief_27 |
C |
May 19, 2023, 6:54 p.m. |
OK |
Java 8 |
TESTS |
10 |
186 |
79872000 |
|
|
206554232 |
Zoatel |
C |
May 19, 2023, 5:36 p.m. |
OK |
Java 8 |
TESTS |
8 |
217 |
3788800 |
|
|
206534528 |
kennycs |
C |
May 19, 2023, 4:30 p.m. |
OK |
Java 8 |
TESTS |
8 |
217 |
4710400 |
|
|
206570705 |
lpychemistry |
C |
May 19, 2023, 9:17 p.m. |
OK |
Java 8 |
TESTS |
15 |
218 |
0 |
|
|
206536291 |
s_zx |
C |
May 19, 2023, 4:34 p.m. |
OK |
Java 8 |
TESTS |
8 |
374 |
0 |
|
|
206553559 |
kiethuynh997 |
C |
May 19, 2023, 5:29 p.m. |
OK |
Java 8 |
TESTS |
8 |
374 |
0 |
|
|
206538713 |
AbdullahNoor |
C |
May 19, 2023, 4:39 p.m. |
OK |
Java 8 |
TESTS |
8 |
374 |
0 |
|
|
206535239 |
YiYun344133 |
C |
May 19, 2023, 4:31 p.m. |
OK |
Java 8 |
TESTS |
8 |
374 |
0 |
|
|
206541041 |
Mmm_D |
C |
May 19, 2023, 4:45 p.m. |
OK |
Java 8 |
TESTS |
8 |
405 |
0 |
|
|
206565138 |
prachijha46212 |
C |
May 19, 2023, 7:40 p.m. |
OK |
Java 8 |
TESTS |
10 |
421 |
0 |
|
|
206535913 |
wwj01 |
C |
May 19, 2023, 4:33 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
78 |
819200 |
|
|
206544232 |
kurzwe6er |
C |
May 19, 2023, 4:51 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
187 |
819200 |
|
|
206575125 |
tatianyi |
C |
May 19, 2023, 11:28 p.m. |
OK |
MS C++ 2017 |
TESTS |
15 |
187 |
1638400 |
|
|
206553132 |
chiragrana03 |
C |
May 19, 2023, 5:25 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
187 |
1638400 |
|
|
206536766 |
ChopaChin |
C |
May 19, 2023, 4:35 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
202 |
819200 |
|
|
206534304 |
Zeyad.AnkhAmon99 |
C |
May 19, 2023, 4:29 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
202 |
819200 |
|
|
206547217 |
mukhaledd |
C |
May 19, 2023, 5:06 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
202 |
1638400 |
|
|
206539645 |
Gorshkov_Kirill |
C |
May 19, 2023, 4:41 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
218 |
3276800 |
|
|
206559071 |
torqueaj |
C |
May 19, 2023, 6:24 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
264 |
15360000 |
|
|
206556271 |
jvatsal0709 |
C |
May 19, 2023, 5:56 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
265 |
15360000 |
|
|
206565851 |
dominator1234 |
C |
May 19, 2023, 7:51 p.m. |
OK |
PyPy 3 |
TESTS |
15 |
280 |
21606400 |
|
|
206556361 |
khanter_ |
C |
May 19, 2023, 5:57 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
296 |
15052800 |
|
|
206558289 |
brokie |
C |
May 19, 2023, 6:16 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
311 |
21708800 |
|
|
206545676 |
bilalboualam63 |
C |
May 19, 2023, 4:57 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
358 |
19251200 |
|
|
206544943 |
Ayushman_123 |
C |
May 19, 2023, 4:54 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
373 |
21196800 |
|
|
206538389 |
germanjke |
C |
May 19, 2023, 4:38 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
374 |
19046400 |
|
|
206560863 |
ashmit-453 |
C |
May 19, 2023, 6:45 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
389 |
19148800 |
|
|
206540062 |
binijamin_et |
C |
May 19, 2023, 4:42 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
389 |
19148800 |
|
|
206548123 |
deni1000 |
C |
May 19, 2023, 5:12 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
124 |
26624000 |
|
|
206560474 |
reijnnn |
C |
May 19, 2023, 6:40 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
139 |
22323200 |
|
|
206560748 |
aspiringquant |
C |
May 19, 2023, 6:44 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
139 |
27545600 |
|
|
206556096 |
alexwice |
C |
May 19, 2023, 5:54 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
139 |
27648000 |
|
|
206545328 |
VNThanhNT |
C |
May 19, 2023, 4:55 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
140 |
20684800 |
|
|
206535336 |
Nailu_YARA |
C |
May 19, 2023, 4:31 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
155 |
30105600 |
|
|
206554722 |
cholebhature |
C |
May 19, 2023, 5:40 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
170 |
24780800 |
|
|
206558082 |
Venia |
C |
May 19, 2023, 6:14 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
170 |
30310400 |
|
|
206572392 |
jerome_coding |
C |
May 19, 2023, 10 p.m. |
OK |
PyPy 3-64 |
TESTS |
15 |
171 |
27648000 |
|
|
206557864 |
gardengnome |
C |
May 19, 2023, 6:11 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
171 |
35942400 |
|
|
206537368 |
eugalt |
C |
May 19, 2023, 4:36 p.m. |
OK |
Python 3 |
TESTS |
8 |
108 |
30515200 |
|
|
206559230 |
andri_trap |
C |
May 19, 2023, 6:26 p.m. |
OK |
Python 3 |
TESTS |
10 |
109 |
28672000 |
|
|
206547184 |
Riyajulhasan |
C |
May 19, 2023, 5:06 p.m. |
OK |
Python 3 |
TESTS |
8 |
109 |
28672000 |
|
|
206544582 |
chait2004 |
C |
May 19, 2023, 4:52 p.m. |
OK |
Python 3 |
TESTS |
8 |
124 |
26214400 |
|
|
206540678 |
MoMoSwog |
C |
May 19, 2023, 4:44 p.m. |
OK |
Python 3 |
TESTS |
8 |
124 |
26214400 |
|
|
206539132 |
2000031490sisir |
C |
May 19, 2023, 4:40 p.m. |
OK |
Python 3 |
TESTS |
8 |
124 |
26214400 |
|
|
206537535 |
sahil_54 |
C |
May 19, 2023, 4:36 p.m. |
OK |
Python 3 |
TESTS |
8 |
124 |
26214400 |
|
|
206545001 |
smanikantam |
C |
May 19, 2023, 4:54 p.m. |
OK |
Python 3 |
TESTS |
8 |
124 |
26521600 |
|
|
206541389 |
lifekarthik23 |
C |
May 19, 2023, 4:45 p.m. |
OK |
Python 3 |
TESTS |
8 |
124 |
27238400 |
|
|
206534669 |
Bakdaulet199 |
C |
May 19, 2023, 4:30 p.m. |
OK |
Python 3 |
TESTS |
8 |
124 |
27238400 |
|
|
206535369 |
2100032549rushmitha |
C |
May 19, 2023, 4:31 p.m. |
OK |
Ruby 3 |
TESTS |
8 |
421 |
15257600 |
|
|
206537434 |
AhmedZaghloul |
C |
May 19, 2023, 4:36 p.m. |
OK |
Rust 2021 |
TESTS |
8 |
46 |
19865600 |
|
|
remove filters
Back to search problems