Codeforces Round 1026 (Div. 2)

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
2110 Codeforces Round 1026 (Div. 2) FINISHED False 7200 28308323 May 24, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 8529 ) D Fewer Batteries PROGRAMMING binary search dfs and similar dp graphs greedy

In 2077, when robots took over the world, they decided to compete in the following game. There are (n) checkpoints, and the (i)-th checkpoint contains (b_i) batteries. Initially, the Robot starts at the (1)-st checkpoint with no batteries and must reach the (n)-th checkpoint. There are a total of (m) one-way passages between the checkpoints. The (i)-th passage allows movement from point (s_i) to point (t_i) ((s_i < t_i)), but not the other way. Additionally, the (i)-th passage can only be used if the robot has at least (w_i) charged batteries; otherwise, it will run out of power on the way. When the robot arrives at point (v), it can additionally take any number of batteries from (0) to (b_v), inclusive. Moreover, it always carries all previously collected batteries, and at each checkpoint, it recharges all previously collected batteries. Find the minimum number of batteries that the robot can have at the end of the journey, or report that it is impossible to reach from the first checkpoint to the last. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains two integers (n, m) ((2 \leq n \leq 2 \cdot 10^5, 0 \leq m \leq 3 \cdot 10^5)) — the number of checkpoints and the number of passages, respectively. The second line contains (n) numbers (b_i) ((0 \leq b_i \leq 10^9)) — the number of batteries at the (i)-th checkpoint. The next (m) lines contain three integers (s_i, t_i, w_i) ((1 \leq s_i < t_i \leq n, 1 \leq w_i \leq 10^9)) — the endpoints of the passage and the minimum number of batteries required to pass through it. It is guaranteed that the sum of (n) does not exceed (2 \cdot 10^5). It is guaranteed that the sum of (m) does not exceed (3 \cdot 10^5). For each test case, output the minimum n

Tutorials

Codeforces Round 1026 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
321197391 hzq18_ D May 25, 2025, 5:30 a.m. OK C++17 (GCC 7-32) TESTS 32 281 9830400
321188192 CeHang D May 25, 2025, 3:24 a.m. OK C++17 (GCC 7-32) TESTS 32 296 5222400
321192942 2-qiym D May 25, 2025, 4:36 a.m. OK C++17 (GCC 7-32) TESTS 32 296 6656000
321161597 TEoS D May 24, 2025, 7:16 p.m. OK C++17 (GCC 7-32) TESTS 31 296 6860800
321142605 EatOrSleep D May 24, 2025, 4:32 p.m. OK C++17 (GCC 7-32) TESTS 30 296 6860800
321191383 TiaCoder D May 25, 2025, 4:14 a.m. OK C++17 (GCC 7-32) TESTS 32 296 7168000
321138268 Abeke D May 24, 2025, 4:25 p.m. OK C++17 (GCC 7-32) TESTS 30 296 8294400
321143243 fengqiuqiuqiu D May 24, 2025, 4:33 p.m. OK C++17 (GCC 7-32) TESTS 30 296 15462400
321183286 Ylx22 D May 25, 2025, 1:45 a.m. OK C++17 (GCC 7-32) TESTS 32 311 5939200
321159618 EndMyMisery D May 24, 2025, 6:55 p.m. OK C++17 (GCC 7-32) TESTS 31 311 9113600
321192009 Jteh D May 25, 2025, 4:23 a.m. OK C++20 (GCC 13-64) TESTS 32 234 9318400
321153144 FUFEELINGS D May 24, 2025, 5:58 p.m. OK C++20 (GCC 13-64) TESTS 30 234 9523200
321166468 Mariom D May 24, 2025, 8:14 p.m. OK C++20 (GCC 13-64) TESTS 32 249 9318400
321143154 moniniya D May 24, 2025, 4:33 p.m. OK C++20 (GCC 13-64) TESTS 30 249 27750400
321173845 tetefe D May 24, 2025, 11:07 p.m. OK C++20 (GCC 13-64) TESTS 32 249 33587200
321139500 Dessa D May 24, 2025, 4:27 p.m. OK C++20 (GCC 13-64) TESTS 30 249 48128000
321185289 TranQuocKhanh D May 25, 2025, 2:32 a.m. OK C++20 (GCC 13-64) TESTS 32 250 9318400
321143076 Abdalaziz_Alshami D May 24, 2025, 4:33 p.m. OK C++20 (GCC 13-64) TESTS 30 250 9318400
321165511 Mad_Nad D May 24, 2025, 8:01 p.m. OK C++20 (GCC 13-64) TESTS 32 264 9216000
321187915 Light_Pursuer D May 25, 2025, 3:20 a.m. OK C++20 (GCC 13-64) TESTS 32 265 9011200
321143829 nicnaknic D May 24, 2025, 4:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 233 48128000
321188793 Hanyilin D May 25, 2025, 3:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 32 234 9318400
321147881 zwyq_16 D May 24, 2025, 5:24 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 234 35532800
321160617 PyAlpha D May 24, 2025, 7:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 31 249 1638400
321188879 FangYifan D May 25, 2025, 3:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 32 249 10240000
321138699 mridulChhipa D May 24, 2025, 4:26 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 249 15462400
321190912 anyi0 D May 25, 2025, 4:07 a.m. OK C++23 (GCC 14-64, msys2) TESTS 32 249 15872000
321190994 emni_o D May 25, 2025, 4:09 a.m. OK C++23 (GCC 14-64, msys2) TESTS 32 249 15872000
321200507 flow2023 D May 25, 2025, 6:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 32 249 15974400
321173848 xrqqqqq D May 24, 2025, 11:07 p.m. OK C++23 (GCC 14-64, msys2) TESTS 32 249 33587200
321139459 PlayDate D May 24, 2025, 4:27 p.m. OK Java 21 TESTS 30 765 45465600
321148511 sahasrad D May 24, 2025, 5:27 p.m. OK Java 21 TESTS 30 796 34713600
321173491 wddd D May 24, 2025, 10:55 p.m. OK Java 21 TESTS 32 936 99942400
321168945 shatty D May 24, 2025, 8:53 p.m. OK Java 21 TESTS 32 1155 67481600
321152243 shre99 D May 24, 2025, 5:51 p.m. OK Java 21 TESTS 30 1171 104345600
321143130 code_breaker_1 D May 24, 2025, 4:33 p.m. OK Java 21 TESTS 30 1187 51609600
321154199 Burhan_Akkus D May 24, 2025, 6:06 p.m. OK Java 21 TESTS 30 1234 91443200
321169212 shatty D May 24, 2025, 8:58 p.m. OK Java 21 TESTS 32 1280 116326400
321155660 Burhan_Akkus D May 24, 2025, 6:18 p.m. OK Java 21 TESTS 31 1281 90931200
321169139 shatty D May 24, 2025, 8:57 p.m. OK Java 21 TESTS 32 1296 97894400
321191794 harrypotter1234hogwarts D May 25, 2025, 4:20 a.m. OK Java 8 TESTS 32 796 57139200
321144224 BrutHawk D May 24, 2025, 4:34 p.m. OK Java 8 TESTS 30 921 64102400
321156786 kasiru_69 D May 24, 2025, 6:28 p.m. OK Java 8 TESTS 31 1015 43008000
321140520 Pranav_45 D May 24, 2025, 4:29 p.m. OK Java 8 TESTS 30 1061 63488000
321156467 kasiru_69 D May 24, 2025, 6:25 p.m. OK Java 8 TESTS 31 1156 42905600
321141167 Khushboo_Singh1111 D May 24, 2025, 4:30 p.m. OK Java 8 TESTS 30 1890 64204800
321137719 iitamansharma D May 24, 2025, 4:24 p.m. OK Kotlin 1.9 TESTS 30 2265 64921600
321147391 Mukundan314 D May 24, 2025, 5:21 p.m. OK PyPy 3-64 TESTS 30 437 75468800
321142631 ArpitJain0908 D May 24, 2025, 4:32 p.m. OK PyPy 3-64 TESTS 30 577 72601600
321173604 0xtech-wiz D May 24, 2025, 10:59 p.m. OK PyPy 3-64 TESTS 32 639 76800000
321142706 kaftan D May 24, 2025, 4:32 p.m. OK PyPy 3-64 TESTS 30 687 69734400
321139885 Wall_breaker12 D May 24, 2025, 4:28 p.m. OK PyPy 3-64 TESTS 30 702 148377600
321144303 anna_yang D May 24, 2025, 4:34 p.m. OK PyPy 3-64 TESTS 30 734 133222400
321138261 Kabish07 D May 24, 2025, 4:25 p.m. OK PyPy 3-64 TESTS 30 749 165478400
321150247 x3mka D May 24, 2025, 5:38 p.m. OK PyPy 3-64 TESTS 30 796 107929600
321144035 BlueHue D May 24, 2025, 4:34 p.m. OK PyPy 3-64 TESTS 30 843 102297600
321138356 minuki646 D May 24, 2025, 4:25 p.m. OK PyPy 3-64 TESTS 30 874 79974400
321164089 polanskiefrain7 D May 24, 2025, 7:43 p.m. OK Python 2 TESTS 31 1999 104960000
321143977 khushi_khandelwal D May 24, 2025, 4:34 p.m. OK Python 3 TESTS 30 1031 82841600
321137768 suyu1491 D May 24, 2025, 4:24 p.m. OK Python 3 TESTS 30 1078 82841600
321141901 Yug4869 D May 24, 2025, 4:31 p.m. OK Python 3 TESTS 30 1250 149708800
321143139 parizz D May 24, 2025, 4:33 p.m. OK Python 3 TESTS 30 1311 78540800
321151515 kon27 D May 24, 2025, 5:46 p.m. OK Python 3 TESTS 30 1781 137523200
321152815 kon27 D May 24, 2025, 5:56 p.m. OK Python 3 TESTS 30 1812 138137600
321139582 KGC_444 D May 24, 2025, 4:27 p.m. OK Python 3 TESTS 30 2312 148377600
321153260 kon27 D May 24, 2025, 5:59 p.m. OK Python 3 TESTS 30 2733 135270400
321168212 lovya_006 D May 24, 2025, 8:40 p.m. OK Python 3 TESTS 32 2968 83251200
321164968 hodor12 D May 24, 2025, 7:54 p.m. OK Rust 2021 TESTS 31 202 23552000
321150248 DeanMenezes2 D May 24, 2025, 5:38 p.m. OK Rust 2021 TESTS 30 203 25088000
321174331 SnowballSH D May 24, 2025, 11:25 p.m. OK Rust 2021 TESTS 32 218 39628800
321152142 NagisaF D May 24, 2025, 5:50 p.m. OK Rust 2021 TESTS 30 311 29491200
321151883 NagisaF D May 24, 2025, 5:48 p.m. OK Rust 2021 TESTS 30 343 30617600

remove filters

Back to search problems