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.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
---|---|---|---|---|---|---|
1995 | Codeforces Round 961 (Div. 2) | FINISHED | False | 7200 | 10077899 | July 23, 2024, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 17952 ) | B1 | Bouquet (Easy Version) | PROGRAMMING | binary search brute force greedy sortings sortings two pointers |
B'This is the easy version of the problem. The only difference is that in this version, the flowers are specified by enumeration. A girl is preparing for her birthday and wants to buy the most beautiful bouquet. There are a total of n flowers in the store, each of which is characterized by the number of petals, and a flower with k petals costs k coins. The girl has decided that the difference in the number of petals between any two flowers she will use in her bouquet should not exceed one. At the same time, the girl wants to assemble a bouquet with the maximum possible number of petals. Unfortunately, she only has m coins, and she cannot spend more. What is the maximum total number of petals she can assemble in the bouquet? Each test consists of several test cases. The first line contains a single integer t ( 1 <= t <= 10 ,000 ) -- the number of test cases. This is followed by descriptions of the test cases. The first line of each test case contains two integers n , m ( 1 <= n <= 2 cdot 10^5, 1 <= m <= 10^{18} ) -- the number of flowers in the store and the number of coins the girl possesses, respectively. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= 10^9 ), where a_i is the number of petals of the i -th flower in the store. The sum of n over all test cases does not exceed 2 cdot {10}^5 . For each test case, output a single integer -- the maximum possible number of petals in the bouquet that the girl can assemble while meeting all the conditions listed above. In the first test case, you can assemble a bouquet with (1, 1, 2, 2), (2, 2, 3), (1, 1), (2, 2) . The maximum over all valid bouquets not greater than 10 is 7 for (2, 2, 3) . In the third test case, you can assemble a bouquet with only one flower of any type, so the answer is 610 . In the fourth test case, you can assemble a bouque'... |
Video Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
272250834 | shi_vam211 | B1 | July 24, 2024, 5 a.m. | OK | C++14 (GCC 6-32) | TESTS | 13 | 93 | 0 | ||
272196937 | sunumbrella | B1 | July 23, 2024, 5:42 p.m. | OK | C++14 (GCC 6-32) | TESTS | 11 | 93 | 0 | ||
272198876 | _toothless | B1 | July 23, 2024, 5:54 p.m. | OK | C++14 (GCC 6-32) | TESTS | 12 | 93 | 1126400 | ||
272245368 | XueHua0.1 | B1 | July 24, 2024, 3:59 a.m. | OK | C++14 (GCC 6-32) | TESTS | 13 | 93 | 1638400 | ||
272207458 | Ha_13 | B1 | July 23, 2024, 7:04 p.m. | OK | C++14 (GCC 6-32) | TESTS | 13 | 108 | 0 | ||
272201567 | Krish_Chothani | B1 | July 23, 2024, 6:14 p.m. | OK | C++14 (GCC 6-32) | TESTS | 13 | 108 | 0 | ||
272176005 | mrtsmile | B1 | July 23, 2024, 5:21 p.m. | OK | C++14 (GCC 6-32) | TESTS | 11 | 108 | 7987200 | ||
272251104 | pratyush2331 | B1 | July 24, 2024, 5:02 a.m. | OK | C++14 (GCC 6-32) | TESTS | 13 | 109 | 0 | ||
272230183 | Gusare | B1 | July 24, 2024, 1:19 a.m. | OK | C++14 (GCC 6-32) | TESTS | 13 | 109 | 0 | ||
272218568 | Laila_18 | B1 | July 23, 2024, 9:23 p.m. | OK | C++14 (GCC 6-32) | TESTS | 13 | 109 | 0 | ||
272251692 | RahulRM13 | B1 | July 24, 2024, 5:08 a.m. | OK | C++17 (GCC 7-32) | TESTS | 13 | 78 | 3481600 | ||
272214545 | nk337cse | B1 | July 23, 2024, 8:25 p.m. | OK | C++17 (GCC 7-32) | TESTS | 13 | 92 | 0 | ||
272197525 | pipipipipi43 | B1 | July 23, 2024, 5:46 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 92 | 0 | ||
272256216 | SALT7 | B1 | July 24, 2024, 5:53 a.m. | OK | C++17 (GCC 7-32) | TESTS | 14 | 93 | 0 | ||
272255130 | Mauricio_7 | B1 | July 24, 2024, 5:43 a.m. | OK | C++17 (GCC 7-32) | TESTS | 13 | 93 | 0 | ||
272253217 | abhinav139 | B1 | July 24, 2024, 5:23 a.m. | OK | C++17 (GCC 7-32) | TESTS | 13 | 93 | 0 | ||
272252967 | xallei | B1 | July 24, 2024, 5:21 a.m. | OK | C++17 (GCC 7-32) | TESTS | 13 | 93 | 0 | ||
272252808 | devu007 | B1 | July 24, 2024, 5:19 a.m. | OK | C++17 (GCC 7-32) | TESTS | 13 | 93 | 0 | ||
272250784 | truong_8502 | B1 | July 24, 2024, 4:59 a.m. | OK | C++17 (GCC 7-32) | TESTS | 13 | 93 | 0 | ||
272250317 | hoangbinhthuong2k5 | B1 | July 24, 2024, 4:55 a.m. | OK | C++17 (GCC 7-32) | TESTS | 13 | 93 | 0 | ||
272205140 | Master32WSP | B1 | July 23, 2024, 6:42 p.m. | OK | C++20 (GCC 13-64) | TESTS | 13 | 61 | 307200 | ||
272224507 | ItsLever | B1 | July 23, 2024, 11:38 p.m. | OK | C++20 (GCC 13-64) | TESTS | 13 | 62 | 102400 | ||
272257106 | thunder_volt | B1 | July 24, 2024, 6:02 a.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 77 | 0 | ||
272256721 | Skyee_03 | B1 | July 24, 2024, 5:58 a.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 77 | 0 | ||
272256573 | _GoD | B1 | July 24, 2024, 5:57 a.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 77 | 0 | ||
272244206 | 1sp7stonic | B1 | July 24, 2024, 3:46 a.m. | OK | C++20 (GCC 13-64) | TESTS | 13 | 77 | 0 | ||
272241554 | AmeyPatil | B1 | July 24, 2024, 3:20 a.m. | OK | C++20 (GCC 13-64) | TESTS | 13 | 77 | 0 | ||
272231619 | iamloser1100 | B1 | July 24, 2024, 1:38 a.m. | OK | C++20 (GCC 13-64) | TESTS | 13 | 77 | 0 | ||
272229146 | piyushChoudhary | B1 | July 24, 2024, 1:05 a.m. | OK | C++20 (GCC 13-64) | TESTS | 13 | 77 | 0 | ||
272220867 | Perezcam | B1 | July 23, 2024, 10:08 p.m. | OK | C++20 (GCC 13-64) | TESTS | 13 | 77 | 0 | ||
272176744 | vtiptop | B1 | July 23, 2024, 5:25 p.m. | OK | Go | TESTS | 11 | 202 | 12390400 | ||
272197821 | vtiptop | B1 | July 23, 2024, 5:48 p.m. | OK | Go | TESTS | 11 | 202 | 12492800 | ||
272183530 | vtiptop | B1 | July 23, 2024, 5:31 p.m. | OK | Go | TESTS | 11 | 202 | 12492800 | ||
272219931 | RedStone | B1 | July 23, 2024, 9:48 p.m. | OK | Go | TESTS | 13 | 218 | 13721600 | ||
272197481 | Aviralpatel_0526 | B1 | July 23, 2024, 5:46 p.m. | OK | Java 21 | TESTS | 11 | 296 | 2150400 | ||
272244588 | owess | B1 | July 24, 2024, 3:51 a.m. | OK | Java 21 | TESTS | 13 | 296 | 7270400 | ||
272197918 | RockingMat | B1 | July 23, 2024, 5:49 p.m. | OK | Java 21 | TESTS | 12 | 312 | 716800 | ||
272220118 | aza161 | B1 | July 23, 2024, 9:52 p.m. | OK | Java 21 | TESTS | 13 | 312 | 1638400 | ||
272208633 | varunsh17 | B1 | July 23, 2024, 7:16 p.m. | OK | Java 21 | TESTS | 13 | 327 | 409600 | ||
272242507 | yashjaiswal2509 | B1 | July 24, 2024, 3:28 a.m. | OK | Java 21 | TESTS | 13 | 327 | 1433600 | ||
272174715 | neilchetty | B1 | July 23, 2024, 5:15 p.m. | OK | Java 21 | TESTS | 11 | 327 | 1433600 | ||
272196008 | Remony | B1 | July 23, 2024, 5:36 p.m. | OK | Java 21 | TESTS | 11 | 358 | 921600 | ||
272195557 | purucoder_6742 | B1 | July 23, 2024, 5:34 p.m. | OK | Java 21 | TESTS | 11 | 359 | 20275200 | ||
272215626 | shivamCode | B1 | July 23, 2024, 8:38 p.m. | OK | Java 21 | TESTS | 13 | 374 | 21299200 | ||
272199280 | RebibeMeJett | B1 | July 23, 2024, 5:57 p.m. | OK | Java 8 | TESTS | 12 | 202 | 3993600 | ||
272174420 | bommidilaxman1017 | B1 | July 23, 2024, 5:14 p.m. | OK | Java 8 | TESTS | 11 | 296 | 14745600 | ||
272253818 | aishwarykesarwani | B1 | July 24, 2024, 5:30 a.m. | OK | Java 8 | TESTS | 13 | 342 | 13312000 | ||
272173405 | Ani7657 | B1 | July 23, 2024, 5:10 p.m. | OK | Java 8 | TESTS | 11 | 374 | 19763200 | ||
272210290 | user10 | B1 | July 23, 2024, 7:33 p.m. | OK | Java 8 | TESTS | 13 | 436 | 0 | ||
272207774 | babedummy9612 | B1 | July 23, 2024, 7:08 p.m. | OK | Java 8 | TESTS | 13 | 437 | 0 | ||
272173943 | raghav275 | B1 | July 23, 2024, 5:12 p.m. | OK | Java 8 | TESTS | 11 | 437 | 0 | ||
272199562 | Om77 | B1 | July 23, 2024, 5:59 p.m. | OK | Java 8 | TESTS | 12 | 452 | 0 | ||
272253736 | yash_kumar.rajput | B1 | July 24, 2024, 5:29 a.m. | OK | Java 8 | TESTS | 13 | 483 | 0 | ||
272201298 | maheshqw | B1 | July 23, 2024, 6:11 p.m. | OK | Java 8 | TESTS | 13 | 499 | 0 | ||
272220538 | aza161 | B1 | July 23, 2024, 10:01 p.m. | OK | Kotlin 1.9 | TESTS | 13 | 359 | 21606400 | ||
272220633 | aza161 | B1 | July 23, 2024, 10:03 p.m. | OK | Kotlin 1.9 | TESTS | 13 | 390 | 21606400 | ||
272219709 | aza161 | B1 | July 23, 2024, 9:43 p.m. | OK | Kotlin 1.9 | TESTS | 13 | 421 | 21606400 | ||
272176517 | L-S-S | B1 | July 23, 2024, 5:24 p.m. | OK | Kotlin 1.9 | TESTS | 11 | 452 | 18841600 | ||
272220926 | aza161 | B1 | July 23, 2024, 10:09 p.m. | OK | Kotlin 1.9 | TESTS | 13 | 578 | 30412800 | ||
272240972 | lh_code | B1 | July 24, 2024, 3:14 a.m. | OK | PyPy 3 | TESTS | 13 | 359 | 21504000 | ||
272213726 | harshkankhar1 | B1 | July 23, 2024, 8:14 p.m. | OK | PyPy 3 | TESTS | 13 | 374 | 18432000 | ||
272227361 | gsomani | B1 | July 24, 2024, 12:38 a.m. | OK | PyPy 3-64 | TESTS | 13 | 155 | 26931200 | ||
272208412 | singh.eureka | B1 | July 23, 2024, 7:14 p.m. | OK | PyPy 3-64 | TESTS | 13 | 155 | 28057600 | ||
272205300 | monadtransformer | B1 | July 23, 2024, 6:44 p.m. | OK | PyPy 3-64 | TESTS | 13 | 171 | 21708800 | ||
272247289 | yer_06 | B1 | July 24, 2024, 4:21 a.m. | OK | PyPy 3-64 | TESTS | 13 | 171 | 27648000 | ||
272176791 | skullbuster__ | B1 | July 23, 2024, 5:26 p.m. | OK | PyPy 3-64 | TESTS | 11 | 171 | 27750400 | ||
272215341 | Namika | B1 | July 23, 2024, 8:34 p.m. | OK | PyPy 3-64 | TESTS | 13 | 171 | 28057600 | ||
272197038 | melke_mk | B1 | July 23, 2024, 5:42 p.m. | OK | PyPy 3-64 | TESTS | 11 | 171 | 28057600 | ||
272197326 | skullbuster__ | B1 | July 23, 2024, 5:44 p.m. | OK | PyPy 3-64 | TESTS | 11 | 171 | 29593600 | ||
272216427 | Triump_0112 | B1 | July 23, 2024, 8:49 p.m. | OK | PyPy 3-64 | TESTS | 13 | 171 | 30208000 | ||
272217739 | interactivemath | B1 | July 23, 2024, 9:09 p.m. | OK | PyPy 3-64 | TESTS | 13 | 171 | 32563200 | ||
272204187 | phantrongnghia510 | B1 | July 23, 2024, 6:33 p.m. | OK | Python 3 | TESTS | 13 | 218 | 26214400 | ||
272204329 | phantrongnghia510 | B1 | July 23, 2024, 6:35 p.m. | OK | Python 3 | TESTS | 13 | 233 | 27750400 | ||
272204404 | phantrongnghia510 | B1 | July 23, 2024, 6:35 p.m. | OK | Python 3 | TESTS | 13 | 234 | 28364800 | ||
272206982 | MTA9402 | B1 | July 23, 2024, 7 p.m. | OK | Python 3 | TESTS | 13 | 280 | 26521600 | ||
272227701 | mo7_adl | B1 | July 24, 2024, 12:43 a.m. | OK | Python 3 | TESTS | 13 | 280 | 26931200 | ||
272176724 | juanbueno00k | B1 | July 23, 2024, 5:25 p.m. | OK | Python 3 | TESTS | 11 | 296 | 25395200 | ||
272203940 | phantrongnghia510 | B1 | July 23, 2024, 6:31 p.m. | OK | Python 3 | TESTS | 13 | 312 | 26112000 | ||
272211546 | kizago | B1 | July 23, 2024, 7:48 p.m. | OK | Python 3 | TESTS | 13 | 327 | 26316800 | ||
272176481 | garvitpandey | B1 | July 23, 2024, 5:24 p.m. | OK | Python 3 | TESTS | 11 | 327 | 26624000 | ||
272175859 | chifuyu_ | B1 | July 23, 2024, 5:21 p.m. | OK | Python 3 | TESTS | 11 | 343 | 26214400 | ||
272210044 | hmi | B1 | July 23, 2024, 7:31 p.m. | OK | Rust 2021 | TESTS | 13 | 77 | 2560000 | ||
272234898 | bqn | B1 | July 24, 2024, 2:15 a.m. | OK | Rust 2021 | TESTS | 13 | 77 | 9625600 | ||
272175183 | fieubat2x | B1 | July 23, 2024, 5:17 p.m. | OK | Rust 2021 | TESTS | 11 | 93 | 15257600 |
Back to search problems