Codeforces Round 946 (Div. 3)

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
1974 Codeforces Round 946 (Div. 3) FINISHED False 8100 60189923 May 20, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 11226 ) E Money Buys Happiness PROGRAMMING dp 1800

Being a physicist, Charlie likes to plan his life in simple and precise terms. For the next m months, starting with no money, Charlie will work hard and earn x pounds per month. For the i -th month (1 <= i <= m) , there'll be a single opportunity of paying cost c_i pounds to obtain happiness h_i . Borrowing is not allowed. Money earned in the i -th month can only be spent in a later j -th month ( j>i ). Since physicists don't code, help Charlie find the maximum obtainable sum of happiness. The first line of input contains a single integer t ( 1 <= t <= 1000 ) -- the number of test cases. The first line of each test case contains two integers, m and x ( 1 <= m <= 50 , 1 <= x <= 10^8 ) -- the total number of months and the monthly salary. The i -th of the following m lines contains two integers, c_i and h_i ( 0 <= c_i <= 10^8 , 1 <= h_i <= 10^3 ) -- the cost and happiness on offer for the i -th month. Note that some happiness may be free ( c_i=0 for some i 's). It is guaranteed that the sum of sum_i h_i over all test cases does not exceed 10^5 . For each test case, print a single integer, the maximum sum of happiness Charlie could obtain. In the first test case, Charlie only gets paid at the end of the month, so is unable to afford anything. In the second test case, Charlie obtains the free happiness in the first month. In the third test case, it's optimal for Charlie to buy happiness in the second month. Even with money left at the end, Charlie could not go back in time to obtain the happiness on offer in the first month.

Tutorials

Codeforces Round #946 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
263064198 bati06 E May 28, 2024, 8:51 p.m. OK C# 10 TESTS 20 124 3481600 1800
263220994 mban259 E May 30, 2024, 10:19 a.m. OK C# 10 TESTS 20 124 9932800 1800
263062132 bati06 E May 28, 2024, 8:17 p.m. OK C# 10 TESTS 20 140 20275200 1800
263060775 bati06 E May 28, 2024, 7:58 p.m. OK C# 10 TESTS 20 140 20275200 1800
263089025 bkifhr10 E May 29, 2024, 5:19 a.m. OK C++14 (GCC 6-32) TESTS 20 61 7987200 1800
263197735 always_still E May 30, 2024, 4:12 a.m. OK C++14 (GCC 6-32) TESTS 20 62 0 1800
263155751 Sonatto E May 29, 2024, 2:26 p.m. OK C++14 (GCC 6-32) TESTS 20 62 819200 1800
263578350 whale142857 E June 1, 2024, 5:30 a.m. OK C++14 (GCC 6-32) TESTS 20 62 819200 1800
262997784 Uncertainly E May 28, 2024, 10:51 a.m. OK C++14 (GCC 6-32) TESTS 20 62 819200 1800
262668622 JKL891402 E May 26, 2024, 7:47 a.m. OK C++14 (GCC 6-32) TESTS 20 77 0 1800
262885724 huangyanfeng E May 27, 2024, 1:16 p.m. OK C++14 (GCC 6-32) TESTS 20 77 0 1800
262686455 itz_pabloo E May 26, 2024, 10:08 a.m. OK C++14 (GCC 6-32) TESTS 20 77 0 1800
262892718 hokma E May 27, 2024, 2:11 p.m. OK C++14 (GCC 6-32) TESTS 20 77 409600 1800
262863853 superDev007 E May 27, 2024, 10:25 a.m. OK C++14 (GCC 6-32) TESTS 20 77 819200 1800
262712898 MoYu25 E May 26, 2024, 1:53 p.m. OK C++17 (GCC 7-32) TESTS 20 61 0 1800
262860739 oath E May 27, 2024, 9:57 a.m. OK C++17 (GCC 7-32) TESTS 20 62 0 1800
263680813 kevinl2005 E June 1, 2024, 8:59 p.m. OK C++17 (GCC 7-32) TESTS 20 62 0 1800
263652713 suchet_k E June 1, 2024, 3:56 p.m. OK C++17 (GCC 7-32) TESTS 20 62 0 1800
263560089 lol____lol E June 1, 2024, 1:05 a.m. OK C++17 (GCC 7-32) TESTS 20 62 0 1800
263259593 benjaminnn E May 30, 2024, 1:58 p.m. OK C++17 (GCC 7-32) TESTS 20 62 0 1800
263163673 xcd_ E May 29, 2024, 3:39 p.m. OK C++17 (GCC 7-32) TESTS 20 62 0 1800
262926277 4rn4vg E May 27, 2024, 7:12 p.m. OK C++17 (GCC 7-32) TESTS 20 62 0 1800
262922454 danielvitor23 E May 27, 2024, 6:28 p.m. OK C++17 (GCC 7-32) TESTS 20 62 0 1800
262783414 _L0giCAL_ E May 26, 2024, 5:18 p.m. OK C++17 (GCC 7-32) TESTS 20 62 0 1800
263210730 div3_enjoyer E May 30, 2024, 8:01 a.m. OK C++20 (GCC 13-64) TESTS 20 46 0 1800
263689196 Gabriel___ E June 2, 2024, 1:10 a.m. OK C++20 (GCC 13-64) TESTS 20 46 0 1800
263082566 Amary_llis E May 29, 2024, 3:43 a.m. OK C++20 (GCC 13-64) TESTS 20 46 3276800 1800
262926563 pranut E May 27, 2024, 7:15 p.m. OK C++20 (GCC 13-64) TESTS 20 61 0 1800
263631316 yasseinhamdy15 E June 1, 2024, 12:51 p.m. OK C++20 (GCC 13-64) TESTS 20 61 0 1800
263230531 cool_boyy E May 30, 2024, 11:31 a.m. OK C++20 (GCC 13-64) TESTS 20 61 0 1800
263217772 Novel_ E May 30, 2024, 9:40 a.m. OK C++20 (GCC 13-64) TESTS 20 61 0 1800
263186364 PDXCFer E May 29, 2024, 9:29 p.m. OK C++20 (GCC 13-64) TESTS 20 61 0 1800
263044274 GGBond21 E May 28, 2024, 5:06 p.m. OK C++20 (GCC 13-64) TESTS 20 61 0 1800
262981616 Libra. E May 28, 2024, 8:30 a.m. OK C++20 (GCC 13-64) TESTS 20 61 0 1800
263219537 oneafter E May 30, 2024, 10:02 a.m. OK Java 21 TESTS 20 265 1536000 1800
263702688 lpychemistry E June 2, 2024, 5:28 a.m. OK Java 21 TESTS 20 280 409600 1800
263160871 c1415926 E May 29, 2024, 3:12 p.m. OK Java 21 TESTS 20 281 1433600 1800
263415885 xhyHover E May 31, 2024, 5:38 a.m. OK Java 21 TESTS 20 296 614400 1800
262888629 ramitg254 E May 27, 2024, 1:38 p.m. OK Java 21 TESTS 20 296 18124800 1800
263041075 stolis E May 28, 2024, 4:38 p.m. OK Java 21 TESTS 20 296 18227200 1800
263158153 mpanyavin E May 29, 2024, 2:47 p.m. OK Java 21 TESTS 20 311 82534400 1800
262669815 Anupam720 E May 26, 2024, 7:56 a.m. OK Java 21 TESTS 20 327 1638400 1800
262889012 ramitg254 E May 27, 2024, 1:41 p.m. OK Java 21 TESTS 20 327 17920000 1800
262504380 daksh_02 E May 25, 2024, 11:42 a.m. OK Java 21 TESTS 20 328 716800 1800
263416098 xhyHover E May 31, 2024, 5:41 a.m. OK Java 8 TESTS 20 202 0 1800
262713679 Dhruvin_Savla E May 26, 2024, 2 p.m. OK Java 8 TESTS 20 218 13926400 1800
262912674 dgucs826 E May 27, 2024, 4:55 p.m. OK Java 8 TESTS 20 265 14028800 1800
262884904 PlayDate E May 27, 2024, 1:10 p.m. OK Java 8 TESTS 20 296 18022400 1800
263198418 190y E May 30, 2024, 4:28 a.m. OK Java 8 TESTS 20 358 0 1800
262851404 seyjs E May 27, 2024, 8:36 a.m. OK Java 8 TESTS 20 733 10956800 1800
262515831 striver_rad E May 25, 2024, 1:42 p.m. OK Java 8 TESTS 20 968 14028800 1800
263063920 hssn E May 28, 2024, 8:46 p.m. OK Kotlin 1.9 TESTS 20 312 18022400 1800
263032398 parth_7042 E May 28, 2024, 3:27 p.m. OK PHP TESTS 20 2155 14745600 1800
262852157 ZzaZi E May 27, 2024, 8:43 a.m. OK PyPy 3 TESTS 20 311 7782400 1800
262603772 sky_coder_ E May 25, 2024, 4:57 p.m. OK PyPy 3 TESTS 20 311 8396800 1800
263572612 dorecorn E June 1, 2024, 4:20 a.m. OK PyPy 3 TESTS 20 390 8806400 1800
262763026 abbas_hammoud E May 26, 2024, 3:45 p.m. OK PyPy 3 TESTS 20 577 9523200 1800
262838760 reijnnn E May 27, 2024, 6:56 a.m. OK PyPy 3-64 TESTS 20 171 4403200 1800
263551638 mer_on E May 31, 2024, 9:22 p.m. OK PyPy 3-64 TESTS 20 202 8601600 1800
263062667 Om_Singh_ E May 28, 2024, 8:25 p.m. OK PyPy 3-64 TESTS 20 217 4403200 1800
262505971 bergus E May 25, 2024, 11:57 a.m. OK PyPy 3-64 TESTS 20 233 22835200 1800
263082507 MengxinWalkingGrass E May 29, 2024, 3:42 a.m. OK PyPy 3-64 TESTS 20 234 5529600 1800
263139203 Daksh_Sahani E May 29, 2024, 12:18 p.m. OK PyPy 3-64 TESTS 20 264 8704000 1800
263038445 2024_how_to_practice E May 28, 2024, 4:16 p.m. OK PyPy 3-64 TESTS 20 265 8806400 1800
263068747 lpt2000 E May 28, 2024, 10:22 p.m. OK PyPy 3-64 TESTS 20 265 10752000 1800
262835845 jvatsal0709 E May 27, 2024, 6:33 a.m. OK PyPy 3-64 TESTS 20 280 8089600 1800
262834709 Taymyr E May 27, 2024, 6:22 a.m. OK PyPy 3-64 TESTS 20 281 6144000 1800
263092156 veera_teja_007 E May 29, 2024, 5:56 a.m. OK Python 3 TESTS 20 968 0 1800
263062647 Om_Singh_ E May 28, 2024, 8:25 p.m. OK Python 3 TESTS 20 1046 0 1800
263680828 REDGAR E June 1, 2024, 8:59 p.m. OK Python 3 TESTS 20 1217 102400 1800
262612238 harshkankhar1 E May 25, 2024, 5:32 p.m. OK Python 3 TESTS 20 1296 102400 1800
262865396 Zisaac E May 27, 2024, 10:38 a.m. OK Python 3 TESTS 20 1578 102400 1800
262865322 Zisaac E May 27, 2024, 10:38 a.m. OK Python 3 TESTS 20 1624 102400 1800
262865547 Tresi28 E May 27, 2024, 10:40 a.m. OK Python 3 TESTS 20 1671 204800 1800
263053477 TOMAS_SHELBY E May 28, 2024, 6:31 p.m. OK Python 3 TESTS 20 1702 102400 1800
263107691 2210030057 E May 29, 2024, 7:59 a.m. OK Python 3 TESTS 20 1733 102400 1800
263107337 code1man E May 29, 2024, 7:57 a.m. OK Python 3 TESTS 20 1733 102400 1800
263081850 BetterThanNobita E May 29, 2024, 3:31 a.m. OK Rust 2021 TESTS 20 77 17203200 1800
262913950 rli43 E May 27, 2024, 5:07 p.m. OK Rust 2021 TESTS 20 265 0 1800
262913758 rli43 E May 27, 2024, 5:05 p.m. OK Rust 2021 TESTS 20 265 0 1800

remove filters

Back to search problems