Codeforces Round 1037 (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
2126 Codeforces Round 1037 (Div. 3) FINISHED False 8100 23642723 July 17, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 23864 ) D This Is the Last Time PROGRAMMING greedy sortings

You are given (n) casinos, numbered from (1) to (n). Each casino is described by three integers: (l_i), (r_i), and (real_i) ((l_i \le real_i \le r_i)). You initially have (k) coins. You can play at casino (i) only if the current number of coins (x) satisfies (l_i \le x \le r_i). After playing, your number of coins becomes (real_i). You can visit the casinos in any order and are not required to visit all of them. Each casino can be visited no more than once. Your task is to find the maximum final number of coins you can obtain. The first line contains a single integer (t) ((1 \le t \le 10^4)) — the number of test cases. The first line of each test case contains two integers (n) and (k) ((1 \le n \le 10^5), (0 \le k \le 10^9)) — the number of casinos and the initial number of coins. This is followed by (n) lines. In the (i)-th line, there are three integers (l_i), (r_i), (real_i) ((0 \le l_i \le real_i \le r_i \le 10^9)) — the parameters of the (i)-th casino. It is guaranteed that the sum of all (n) across all test cases does not exceed (10^5). For each test case, output a single integer — the maximum number of coins you can obtain after optimally choosing the order of visiting the casinos. In the first test case, you can first play at the (2)-nd casino. After that, you will have (2) coins. Then you can play at the (1)-st casino, and the number of coins will increase to (3). Finally, after playing at the (3)-rd casino, you will have (10) coins — this is the maximum possible amount. In the second test case, you have no money, so you cannot earn more. In the fourth test case, it is beneficial to play at the (2)-nd casino right away and earn (4) coins.

Tutorials

144845

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
329583775 shreyasgupta06 D July 18, 2025, 5:47 a.m. OK C++17 (GCC 7-32) TESTS 9 93 0
329567224 Kclz D July 18, 2025, 2:46 a.m. OK C++17 (GCC 7-32) TESTS 9 93 1228800
329581995 Hrishikesh1205 D July 18, 2025, 5:30 a.m. OK C++17 (GCC 7-32) TESTS 9 108 0
329559055 xxxtk D July 18, 2025, 1:04 a.m. OK C++17 (GCC 7-32) TESTS 9 108 0
329582149 yuanmouren D July 18, 2025, 5:31 a.m. OK C++17 (GCC 7-32) TESTS 9 109 0
329574792 bu_xiang_qu_ming D July 18, 2025, 4:03 a.m. OK C++17 (GCC 7-32) TESTS 9 109 0
329572078 iloveMT D July 18, 2025, 3:30 a.m. OK C++17 (GCC 7-32) TESTS 9 109 0
329560887 comlr D July 18, 2025, 1:36 a.m. OK C++17 (GCC 7-32) TESTS 9 109 0
329556590 andyleach D July 18, 2025, 12:03 a.m. OK C++17 (GCC 7-32) TESTS 9 109 0
329555367 Ereny222 D July 17, 2025, 11:21 p.m. OK C++17 (GCC 7-32) TESTS 9 109 0
329574943 Sahriar_Ahmed D July 18, 2025, 4:05 a.m. OK C++20 (GCC 13-64) TESTS 9 93 0
329571725 threeways D July 18, 2025, 3:26 a.m. OK C++20 (GCC 13-64) TESTS 9 93 0
329571652 MH_Nazmul D July 18, 2025, 3:26 a.m. OK C++20 (GCC 13-64) TESTS 9 93 0
329570815 one_punch_Moon D July 18, 2025, 3:18 a.m. OK C++20 (GCC 13-64) TESTS 9 93 0
329568937 Rawz D July 18, 2025, 3:01 a.m. OK C++20 (GCC 13-64) TESTS 9 93 0
329568452 kalaz D July 18, 2025, 2:57 a.m. OK C++20 (GCC 13-64) TESTS 9 93 0
329565383 moshiurmushfique D July 18, 2025, 2:29 a.m. OK C++20 (GCC 13-64) TESTS 9 93 0
329563487 Peterlyee D July 18, 2025, 2:11 a.m. OK C++20 (GCC 13-64) TESTS 9 93 0
329563031 tapvietcode106 D July 18, 2025, 2:06 a.m. OK C++20 (GCC 13-64) TESTS 9 93 0
329561212 Pirate88 D July 18, 2025, 1:41 a.m. OK C++20 (GCC 13-64) TESTS 9 93 0
329526374 424479543 D July 17, 2025, 5:15 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 62 102400
329557854 guoeee D July 18, 2025, 12:40 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 92 102400
329585104 SkillZz_ D July 18, 2025, 6 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 93 0
329583352 Tirth11 D July 18, 2025, 5:44 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 93 0
329581432 yoru_sacri D July 18, 2025, 5:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 93 0
329580794 codefever1912 D July 18, 2025, 5:17 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 93 0
329579754 eliaukkk D July 18, 2025, 5:04 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 93 0
329578999 Hotash_CP_Kore_Lav_Nai D July 18, 2025, 4:56 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 93 0
329578637 UdayKumarPG D July 18, 2025, 4:51 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 93 0
329578551 jackylova_fan_fan_fan D July 18, 2025, 4:50 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 93 0
329557915 xXxNoobSaibotxXx D July 18, 2025, 12:42 a.m. OK D TESTS 9 171 2867200
329554693 NenadDapic D July 17, 2025, 11:01 p.m. OK FPC TESTS 9 140 1228800
329553915 NenadDapic D July 17, 2025, 10:39 p.m. OK FPC TESTS 9 140 1228800
329553975 NenadDapic D July 17, 2025, 10:41 p.m. OK FPC TESTS 9 155 1228800
329560061 ruban D July 18, 2025, 1:21 a.m. OK FPC TESTS 9 202 154112000
329544601 yasigma D July 17, 2025, 7:49 p.m. OK GNU C11 TESTS 9 140 1331200
329575900 legacy45 D July 18, 2025, 4:17 a.m. OK GNU C11 TESTS 9 140 2457600
329570279 AlphaOrionis69 D July 18, 2025, 3:13 a.m. OK GNU C11 TESTS 9 155 13107200
329537645 tirean D July 17, 2025, 6:38 p.m. OK Java 21 TESTS 9 312 614400
329532578 saianudra D July 17, 2025, 5:56 p.m. OK Java 21 TESTS 9 343 1126400
329535027 fatal-98 D July 17, 2025, 6:16 p.m. OK Java 21 TESTS 9 358 307200
329574855 keshav_.agg D July 18, 2025, 4:03 a.m. OK Java 21 TESTS 9 358 819200
329542312 jagadeeshmamilla129 D July 17, 2025, 7:25 p.m. OK Java 21 TESTS 9 359 921600
329575836 atulya_jaiswal D July 18, 2025, 4:16 a.m. OK Java 21 TESTS 9 359 1638400
329540576 kaifkhan. D July 17, 2025, 7:06 p.m. OK Java 21 TESTS 9 359 2764800
329531706 sahasrad D July 17, 2025, 5:50 p.m. OK Java 21 TESTS 9 374 921600
329566648 ikiku D July 18, 2025, 2:42 a.m. OK Java 21 TESTS 9 374 1433600
329581350 __Aviral__ D July 18, 2025, 5:22 a.m. OK Java 21 TESTS 9 374 1843200
329540121 abhayrajnegi0416 D July 17, 2025, 7:02 p.m. OK Java 8 TESTS 9 234 0
329575981 Pranav_45 D July 18, 2025, 4:18 a.m. OK Java 8 TESTS 9 296 40038400
329557973 adityadutt D July 18, 2025, 12:43 a.m. OK Java 8 TESTS 9 328 0
329557314 warframe D July 18, 2025, 12:26 a.m. OK Java 8 TESTS 9 640 0
329557285 warframe D July 18, 2025, 12:25 a.m. OK Java 8 TESTS 9 655 0
329544249 YZH_1014 D July 17, 2025, 7:45 p.m. OK Java 8 TESTS 9 671 102400
329577899 arnabpachal2004 D July 18, 2025, 4:43 a.m. OK Java 8 TESTS 9 687 102400
329533162 iamhorizon D July 17, 2025, 6 p.m. OK Java 8 TESTS 9 733 102400
329569779 SmoothOperator99 D July 18, 2025, 3:09 a.m. OK Java 8 TESTS 9 765 102400
329563384 not_mohith D July 18, 2025, 2:10 a.m. OK Java 8 TESTS 9 765 204800
329577903 darkky D July 18, 2025, 4:43 a.m. OK PyPy 3 TESTS 9 686 25600000
329529125 DSKroc D July 17, 2025, 5:32 p.m. OK PyPy 3 TESTS 9 859 144486400
329563976 naman.iitd28 D July 18, 2025, 2:16 a.m. OK PyPy 3 TESTS 9 1015 11878400
329565477 date727 D July 18, 2025, 2:30 a.m. OK PyPy 3-64 TESTS 9 218 14438400
329580902 Sam_Jiang D July 18, 2025, 5:18 a.m. OK PyPy 3-64 TESTS 9 218 17715200
329565345 date727 D July 18, 2025, 2:29 a.m. OK PyPy 3-64 TESTS 9 249 14438400
329529322 ChickenTamer D July 17, 2025, 5:33 p.m. OK PyPy 3-64 TESTS 9 249 22323200
329585449 maharaja D July 18, 2025, 6:03 a.m. OK PyPy 3-64 TESTS 9 281 22220800
329532986 Mech20934 D July 17, 2025, 5:59 p.m. OK PyPy 3-64 TESTS 9 311 17305600
329535820 JosiSol D July 17, 2025, 6:23 p.m. OK PyPy 3-64 TESTS 9 327 25907200
329547738 Ayis137 D July 17, 2025, 8:31 p.m. OK PyPy 3-64 TESTS 9 342 10240000
329536368 sparadigm D July 17, 2025, 6:27 p.m. OK PyPy 3-64 TESTS 9 389 19763200
329530022 justmega2510 D July 17, 2025, 5:38 p.m. OK PyPy 3-64 TESTS 9 390 21196800
329550523 himoji D July 17, 2025, 9:17 p.m. OK Python 3 TESTS 9 281 26316800
329553103 NenadDapic D July 17, 2025, 10:17 p.m. OK Python 3 TESTS 9 296 15360000
329544435 spyfox89 D July 17, 2025, 7:47 p.m. OK Python 3 TESTS 9 312 18227200
329536450 vidhannahar D July 17, 2025, 6:28 p.m. OK Python 3 TESTS 9 312 25600000
329552453 maan.dhruv D July 17, 2025, 10 p.m. OK Python 3 TESTS 9 327 22528000
329528607 samyaksrivastava9 D July 17, 2025, 5:29 p.m. OK Python 3 TESTS 9 327 26624000
329530780 QuanHo D July 17, 2025, 5:43 p.m. OK Python 3 TESTS 9 358 22732800
329557152 dan2017558 D July 18, 2025, 12:21 a.m. OK Python 3 TESTS 9 359 22937600
329558475 coder.sy D July 18, 2025, 12:53 a.m. OK Python 3 TESTS 9 389 18022400
329583918 svrmalaviya D July 18, 2025, 5:49 a.m. OK Python 3 TESTS 9 390 21196800
329554915 JakeMate14 D July 17, 2025, 11:07 p.m. OK Rust 2021 TESTS 9 109 4300800

remove filters

Back to search problems