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 |
|---|---|---|---|---|---|---|
| 2164 | Codeforces Global Round 30 (Div. 1 + Div. 2) | FINISHED | False | 10800 | 13965923 | Nov. 6, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 1566 ) | E | Journey | PROGRAMMING | dfs and similar dsu graphs greedy |
You are on an undirected connected graph of (n) vertices and (m) weighted edges. The edges are indexed from (1) to (m). The (i)-th edge connects vertex (u_i) and (v_i), and has weight (w_i). You decided to take a wonderful journey around the graph. Suppose you are at vertex (x). You can do the following operations any number of times: Mark an edge connecting (x) and (y), take photos along the edge, and move to (y), which costs exactly the edge's weight. Transfer to another arbitrary vertex (z \neq x) by train. You may choose any path (x\leadsto z) ( not necessarily simple ), and the cost is the weight of the edge with the maximum index on that path. Formally, suppose you choose the path with edge indices (e_1, e_2, \ldots, e_k), such that there exists an array of vertices (p_1, p_2, \ldots, p_{k+1}) where (x = p_1), (z = p_{k+1}), and for all (i) in (1, k), edge (e_i) connects (p_{i}) and (p_{i+1}), the cost is (w_{\max_{i=1}^k e_i}). You are now at vertex (1), and you need to mark every edge at least once and return to vertex (1). Calculate the minimum cost. Please note the cost for transferring is not the maximum weight on the path, nor the maximum index itself. If you have any questions, refer to the Note section below. 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) and (m) ((1 \le n \le 10^6), (0 \le m \le 10^6)). Then (m) lines, the (i)-th line contains three integers (u_i, v_i, w_i) ((1 \le u_i, v_i \le n), (1 \le w \le 10^9)) — meaning that the edge with index (i) is between vertex (u_i) and vertex (v_i) with weight (w_i). It's guaranteed that the described graph is connected. Also note that the graph may have self-loop |
| Codeforces Global Round 30 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 347781995 | wthdouwant | E | Nov. 6, 2025, 6:28 p.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 749 | 36147200 | ||
| 347785538 | Sept | E | Nov. 6, 2025, 6:57 p.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 827 | 42188800 | ||
| 347811892 | _orz | E | Nov. 7, 2025, 2:01 a.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 843 | 52224000 | ||
| 347812564 | wabca | E | Nov. 7, 2025, 2:10 a.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 874 | 32051200 | ||
| 347812118 | p6pou | E | Nov. 7, 2025, 2:05 a.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 874 | 44134400 | ||
| 347820569 | hzk_cpp | E | Nov. 7, 2025, 3:48 a.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 874 | 68198400 | ||
| 347811169 | fangzx | E | Nov. 7, 2025, 1:48 a.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 874 | 68198400 | ||
| 347822592 | IamHereForFun | E | Nov. 7, 2025, 4:14 a.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 905 | 98816000 | ||
| 347767053 | Arxyj | E | Nov. 6, 2025, 5:02 p.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 937 | 205312000 | ||
| 347772723 | crpQwQ | E | Nov. 6, 2025, 5:20 p.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 952 | 76185600 | ||
| 347806196 | maxplus | E | Nov. 7, 2025, 12:11 a.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 218 | 22118400 | ||
| 347805006 | maxplus | E | Nov. 6, 2025, 11:37 p.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 265 | 32153600 | ||
| 347819772 | AsiraeM | E | Nov. 7, 2025, 3:36 a.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 359 | 118476800 | ||
| 347819711 | wukaichen888 | E | Nov. 7, 2025, 3:35 a.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 577 | 36147200 | ||
| 347771761 | WintryIris | E | Nov. 6, 2025, 5:17 p.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 593 | 138547200 | ||
| 347818639 | Donaldqian0712 | E | Nov. 7, 2025, 3:21 a.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 625 | 88166400 | ||
| 347823832 | The_Caspian_Sea | E | Nov. 7, 2025, 4:31 a.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 639 | 44134400 | ||
| 347824523 | Panyang | E | Nov. 7, 2025, 4:41 a.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 640 | 37068800 | ||
| 347805077 | xujindong | E | Nov. 6, 2025, 11:40 p.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 656 | 64102400 | ||
| 347763268 | noya2 | E | Nov. 6, 2025, 4:51 p.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 671 | 32665600 | ||
| 347768110 | Junounly | E | Nov. 6, 2025, 5:06 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 311 | 50176000 | ||
| 347773010 | tko919 | E | Nov. 6, 2025, 5:21 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 327 | 114790400 | ||
| 347801705 | MR_NoSolution | E | Nov. 6, 2025, 10:15 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 593 | 56320000 | ||
| 347811309 | libolin1 | E | Nov. 7, 2025, 1:51 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 624 | 193638400 | ||
| 347828254 | Aword | E | Nov. 7, 2025, 5:29 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 640 | 56320000 | ||
| 347791354 | azure- | E | Nov. 6, 2025, 7:52 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 671 | 70860800 | ||
| 347773774 | huansir | E | Nov. 6, 2025, 5:23 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 718 | 44236800 | ||
| 347826456 | gooonn | E | Nov. 7, 2025, 5:07 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 718 | 112435200 | ||
| 347807924 | seanlsy | E | Nov. 7, 2025, 12:51 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 718 | 112435200 | ||
| 347799651 | matra2137 | E | Nov. 6, 2025, 9:37 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 718 | 120422400 | ||
| 347777223 | ICPCCode | E | Nov. 6, 2025, 5:34 p.m. | OK | GNU C11 | TESTS | 36 | 858 | 73216000 | ||
| 347786714 | gua069 | E | Nov. 6, 2025, 7:08 p.m. | OK | Java 8 | TESTS | 36 | 562 | 91750400 | ||
| 347782509 | smz.26 | E | Nov. 6, 2025, 6:32 p.m. | OK | PyPy 3-64 | TESTS | 36 | 1812 | 214630400 | ||
| 347782077 | smz.26 | E | Nov. 6, 2025, 6:28 p.m. | OK | PyPy 3-64 | TESTS | 36 | 1874 | 214323200 | ||
| 347775317 | xxh1999 | E | Nov. 6, 2025, 5:28 p.m. | OK | PyPy 3-64 | TESTS | 36 | 2249 | 346726400 | ||
| 347776466 | Sapple_ | E | Nov. 6, 2025, 5:32 p.m. | OK | PyPy 3-64 | TESTS | 36 | 2515 | 291020800 | ||
| 347773597 | Ming_Xu | E | Nov. 6, 2025, 5:23 p.m. | OK | Rust 2024 | TESTS | 36 | 1015 | 368947200 | ||
| 347770967 | null_lambda | E | Nov. 6, 2025, 5:15 p.m. | OK | Rust 2024 | TESTS | 36 | 2015 | 473907200 |
Back to search problems