Codeforces Round 1029 (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
2117 Codeforces Round 1029 (Div. 3) FINISHED False 8100 27012323 June 8, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 5115 ) G Omg Graph PROGRAMMING brute force dsu graphs greedy shortest paths sortings

You are given an undirected connected weighted graph. Define the cost of a path of length (k) to be as follows: Let the weights of all the edges on the path be (w_1,...,w_k). The cost of the path is ((\min_{i = 1}^{k}{w_i}) + (\max_{i=1}^{k}{w_i})), or in other words, the maximum edge weight + the minimum edge weight. Across all paths from vertex (1) to (n), report the cost of the path with minimum cost. Note that the path is not necessarily simple. The first line contains an 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 (m) ((2 \le n \le 2 \cdot 10^5, n - 1 \le m \le \min(2 \cdot 10^5, \frac{n(n - 1)}{2}))). The next (m) lines each contain integers (u, v) and (w) ((1 \le u, v \le n, 1 \le w \le 10^9)) representing an edge from vertex (u) to (v) with weight (w). It is guaranteed that the graph does not contain self-loops or multiple edges and the resulting graph is connected. It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5) and that the sum of (m) over all test cases does not exceed (2 \cdot 10^5). For each test case, output a single integer, the minimum cost path from vertex (1) to (n). For the second test case, the optimal path is (1 \rightarrow 2 \rightarrow 1 \rightarrow 3), the edge weights are (5, 5, 13) so the cost is (\min(5, 5, 13) + \max(5, 5, 13) = 5 + 13 = 18). It can be proven that there is no path with lower cost.

Tutorials

Codeforces Round 1029 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
323713392 og.kostya G June 10, 2025, 5:12 a.m. OK C# 13 TESTS 35 312 9728000
323703395 whiteedu G June 10, 2025, 2:50 a.m. OK C++17 (GCC 7-32) TESTS 35 155 2662400
323698186 goldener G June 10, 2025, 1:06 a.m. OK C++17 (GCC 7-32) TESTS 35 171 3584000
323655971 rokkamneeharika G June 9, 2025, 3:26 p.m. OK C++17 (GCC 7-32) TESTS 34 171 4096000
323695589 Shtn G June 9, 2025, 11:37 p.m. OK C++17 (GCC 7-32) TESTS 35 186 1945600
323715932 DerpoFanBoy G June 10, 2025, 5:40 a.m. OK C++17 (GCC 7-32) TESTS 35 187 1126400
323704603 khoa101003 G June 10, 2025, 3:12 a.m. OK C++17 (GCC 7-32) TESTS 35 187 1126400
323662196 InvMod G June 9, 2025, 4:16 p.m. OK C++17 (GCC 7-32) TESTS 34 187 1126400
323643498 Nathan661 G June 9, 2025, 1:51 p.m. OK C++17 (GCC 7-32) TESTS 34 187 1126400
323687078 HarshalBagade21 G June 9, 2025, 8:12 p.m. OK C++17 (GCC 7-32) TESTS 34 187 1945600
323617769 nitish.singh G June 9, 2025, 10:39 a.m. OK C++17 (GCC 7-32) TESTS 34 187 2764800
323704130 _Kee G June 10, 2025, 3:04 a.m. OK C++20 (GCC 13-64) TESTS 35 93 2252800
323701753 sailealt31 G June 10, 2025, 2:19 a.m. OK C++20 (GCC 13-64) TESTS 35 140 2764800
323627757 h354222857 G June 9, 2025, 11:57 a.m. OK C++20 (GCC 13-64) TESTS 34 156 1126400
323616891 h354222857 G June 9, 2025, 10:32 a.m. OK C++20 (GCC 13-64) TESTS 34 156 1126400
323695532 Nika. G June 9, 2025, 11:35 p.m. OK C++20 (GCC 13-64) TESTS 35 156 2662400
323690127 HanaSoliman G June 9, 2025, 9:05 p.m. OK C++20 (GCC 13-64) TESTS 34 156 2764800
323686898 Thorfin_ll G June 9, 2025, 8:10 p.m. OK C++20 (GCC 13-64) TESTS 34 156 3481600
323678569 Koncloud G June 9, 2025, 6:30 p.m. OK C++20 (GCC 13-64) TESTS 34 156 5120000
323713431 nguyenanphat G June 10, 2025, 5:12 a.m. OK C++20 (GCC 13-64) TESTS 35 156 5632000
323677445 chalish_ma G June 9, 2025, 6:21 p.m. OK C++20 (GCC 13-64) TESTS 34 156 7270400
323713825 kakoujt G June 10, 2025, 5:17 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 156 1228800
323657714 mengh04 G June 9, 2025, 3:40 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 156 1228800
323619475 jackylova_fan_fan_fan G June 9, 2025, 10:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 34 156 1228800
323647345 Snowball_511 G June 9, 2025, 2:20 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 156 2048000
323699329 pharaok G June 10, 2025, 1:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 156 2457600
323690529 k1ng_d0m G June 9, 2025, 9:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 156 2867200
323708984 elate G June 10, 2025, 4:15 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 156 5427200
323649823 Zyntherix G June 9, 2025, 2:37 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 156 6041600
323658154 MUZAN G June 9, 2025, 3:43 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 171 409600
323651172 Pervushev G June 9, 2025, 2:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 171 409600
323677651 WrongAnswerOnTestCase2 G June 9, 2025, 6:23 p.m. OK Java 21 TESTS 34 609 12185600
323670536 patrickjane79 G June 9, 2025, 5:21 p.m. OK Java 21 TESTS 34 1155 54579200
323696085 NiffSniff G June 9, 2025, 11:57 p.m. OK Java 21 TESTS 35 1968 65024000
323692647 Sumitsingh7 G June 9, 2025, 10:04 p.m. OK Java 8 TESTS 34 374 18739200
323692540 satyams_9001 G June 9, 2025, 10:01 p.m. OK Java 8 TESTS 34 374 18739200
323700468 ashutoshprj G June 10, 2025, 1:52 a.m. OK Java 8 TESTS 35 1967 52531200
323700591 ashutoshprj G June 10, 2025, 1:54 a.m. OK Java 8 TESTS 35 1984 52224000
323699916 ashutoshprj G June 10, 2025, 1:44 a.m. OK Java 8 TESTS 35 1984 54169600
323706349 gardengnome G June 10, 2025, 3:38 a.m. OK PyPy 3-64 TESTS 35 437 18636800
323683262 gardengnome G June 9, 2025, 7:20 p.m. OK PyPy 3-64 TESTS 34 858 31948800
323682808 gardengnome G June 9, 2025, 7:14 p.m. OK PyPy 3-64 TESTS 34 905 32563200
323607737 Haksell G June 9, 2025, 9:27 a.m. OK PyPy 3-64 TESTS 34 1092 49868800
323708340 hundunlilun1 G June 10, 2025, 4:06 a.m. OK PyPy 3-64 TESTS 35 1358 133222400
323610589 woyeta G June 9, 2025, 9:48 a.m. OK PyPy 3-64 TESTS 34 1389 61644800
323616560 MRP2006 G June 9, 2025, 10:29 a.m. OK PyPy 3-64 TESTS 34 1437 101580800
323692390 hugoback01 G June 9, 2025, 9:57 p.m. OK PyPy 3-64 TESTS 34 1452 85504000
323624671 Akshar_7 G June 9, 2025, 11:33 a.m. OK PyPy 3-64 TESTS 34 1530 96665600
323651303 Polynomu G June 9, 2025, 2:48 p.m. OK PyPy 3-64 TESTS 34 1593 100147200
323613218 EHisgod G June 9, 2025, 10:06 a.m. OK Python 3 TESTS 34 1312 57241600
323644970 davidmiheev G June 9, 2025, 2:02 p.m. OK Rust 2021 TESTS 34 281 48844800

remove filters

Back to search problems