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 of integers l_1, l_2, ... , l_n and an integer d . Is it possible to construct a tree satisfying the following three conditions? Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 250 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains two integers n , d ( 2 <= q n <= q 2000, 1 <= q d <= q 2000 ). The second line of each test case contains n integers l_1, l_2, ... , l_n ( 1 <= q l_i <= q d ). It is guaranteed that the sum of n over all test cases does not exceed 2000 . For each test case, output texttt{Yes} if it is possible to construct a tree that satisfies all the conditions, and texttt{No} otherwise. You can print the letters in any case (upper or lower). Below, you are given the illustrations of trees for the first and third test cases. One of the diameters is highlighted by coloring its edges in red. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
238780937 |
honey |
F |
Dec. 25, 2023, 4:34 a.m. |
OK |
GNU C++14 |
TESTS |
84 |
234 |
1536000 |
|
|
238781116 |
honey |
F |
Dec. 25, 2023, 4:37 a.m. |
OK |
GNU C++14 |
TESTS |
84 |
280 |
1536000 |
|
|
238772028 |
KellyWLJ |
F |
Dec. 25, 2023, 1:20 a.m. |
OK |
GNU C++14 |
TESTS |
83 |
343 |
1638400 |
|
|
238733616 |
-Misaka-Mikoto- |
F |
Dec. 24, 2023, 4:24 p.m. |
OK |
GNU C++14 |
TESTS |
80 |
483 |
1638400 |
|
|
238746263 |
Yzm007 |
F |
Dec. 24, 2023, 5:48 p.m. |
OK |
GNU C++14 |
TESTS |
81 |
748 |
1638400 |
|
|
238774145 |
ciuim |
F |
Dec. 25, 2023, 2:26 a.m. |
OK |
GNU C++14 |
TESTS |
83 |
967 |
2252800 |
|
|
238783917 |
waste_ |
F |
Dec. 25, 2023, 5:12 a.m. |
OK |
GNU C++14 |
TESTS |
84 |
1591 |
1638400 |
|
|
238782926 |
waste_ |
F |
Dec. 25, 2023, 5:01 a.m. |
OK |
GNU C++14 |
TESTS |
84 |
1638 |
1638400 |
|
|
238781927 |
pssnfruit |
F |
Dec. 25, 2023, 4:48 a.m. |
OK |
GNU C++17 |
TESTS |
84 |
343 |
1740800 |
|
|
238732449 |
_chashuibiao_ |
F |
Dec. 24, 2023, 4:21 p.m. |
OK |
GNU C++17 |
TESTS |
80 |
374 |
9728000 |
|
|
238785103 |
2100032523 |
F |
Dec. 25, 2023, 5:25 a.m. |
OK |
GNU C++17 |
TESTS |
84 |
670 |
1638400 |
|
|
238757450 |
Roll_Num_44 |
F |
Dec. 24, 2023, 7:29 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
670 |
1638400 |
|
|
238751432 |
ikaurov |
F |
Dec. 24, 2023, 6:23 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
670 |
1740800 |
|
|
238769182 |
Ronnie007 |
F |
Dec. 24, 2023, 11:31 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
670 |
5632000 |
|
|
238760365 |
sarthakj314 |
F |
Dec. 24, 2023, 8:10 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
686 |
1638400 |
|
|
238748666 |
MisterReaper |
F |
Dec. 24, 2023, 6:03 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
717 |
1536000 |
|
|
238765238 |
El3ageed_Abu_Shehab |
F |
Dec. 24, 2023, 9:37 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
733 |
2150400 |
|
|
238734031 |
liympanda |
F |
Dec. 24, 2023, 4:25 p.m. |
OK |
GNU C++17 |
TESTS |
80 |
748 |
1638400 |
|
|
238775162 |
tarjen |
F |
Dec. 25, 2023, 2:50 a.m. |
OK |
GNU C++17 (64) |
TESTS |
84 |
280 |
1536000 |
|
|
238747708 |
Godjob |
F |
Dec. 24, 2023, 5:57 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
327 |
1843200 |
|
|
238786829 |
akua |
F |
Dec. 25, 2023, 5:42 a.m. |
OK |
GNU C++17 (64) |
TESTS |
84 |
343 |
5120000 |
|
|
238753152 |
BeYourSven |
F |
Dec. 24, 2023, 6:38 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
451 |
1740800 |
|
|
238771546 |
Khozhaev |
F |
Dec. 25, 2023, 1:03 a.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
577 |
2252800 |
|
|
238772248 |
yyyz04 |
F |
Dec. 25, 2023, 1:28 a.m. |
OK |
GNU C++17 (64) |
TESTS |
83 |
685 |
5734400 |
|
|
238771856 |
DJ2006 |
F |
Dec. 25, 2023, 1:15 a.m. |
OK |
GNU C++17 (64) |
TESTS |
82 |
686 |
1638400 |
|
|
238732288 |
ALILILILILI-KHAN |
F |
Dec. 24, 2023, 4:20 p.m. |
OK |
GNU C++17 (64) |
TESTS |
80 |
686 |
1740800 |
|
|
238772795 |
hahatang2004 |
F |
Dec. 25, 2023, 1:47 a.m. |
OK |
GNU C++17 (64) |
TESTS |
83 |
686 |
2560000 |
|
|
238772902 |
hahatang2004 |
F |
Dec. 25, 2023, 1:51 a.m. |
OK |
GNU C++17 (64) |
TESTS |
83 |
702 |
1740800 |
|
|
238746042 |
bobbilyking |
F |
Dec. 24, 2023, 5:47 p.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
109 |
1536000 |
|
|
238732955 |
AbdelmagedNour |
F |
Dec. 24, 2023, 4:22 p.m. |
OK |
GNU C++20 (64) |
TESTS |
80 |
171 |
2048000 |
|
|
238752338 |
Illumina |
F |
Dec. 24, 2023, 6:31 p.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
202 |
1945600 |
|
|
238777988 |
apospototo |
F |
Dec. 25, 2023, 3:46 a.m. |
OK |
GNU C++20 (64) |
TESTS |
84 |
202 |
2252800 |
|
|
238744621 |
krigare |
F |
Dec. 24, 2023, 5:40 p.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
218 |
1843200 |
|
|
238737663 |
LipArcanjo |
F |
Dec. 24, 2023, 4:33 p.m. |
OK |
GNU C++20 (64) |
TESTS |
80 |
218 |
1843200 |
|
|
238752064 |
Illumina |
F |
Dec. 24, 2023, 6:28 p.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
249 |
1843200 |
|
|
238745616 |
YouKn0wWho |
F |
Dec. 24, 2023, 5:45 p.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
265 |
1843200 |
|
|
238745100 |
ManojkumarPatanik |
F |
Dec. 24, 2023, 5:42 p.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
296 |
1740800 |
|
|
238776776 |
ghoul932 |
F |
Dec. 25, 2023, 3:24 a.m. |
OK |
GNU C++20 (64) |
TESTS |
84 |
312 |
2048000 |
|
|
remove filters
Back to search problems