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 |
|---|---|---|---|---|---|---|
| 2239 | Codeforces Round 1105 (Div. 1) | FINISHED | False | 9000 | 3338710 | June 27, 2026, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 159 ) | E | The end of this world, | PROGRAMMING | divide and conquer dsu |
You are given an undirected graph consisting of (n) vertices and (m) edges. The (i)-th vertex has an associated value (\mathrm{val}_i). The (j)-th edge connects vertices (u_j) and (v_j) and has two properties: a capacity (w_j) and a floor (\mathrm{low}_j). It is guaranteed that (w_j \ge \mathrm{low}_j) for all edges. You want to start a walk from a vertex (s). Before the walk begins, you must choose an arbitrary non-negative integer (h_{start}) as your initial state parameter. If you are currently at vertex (u) with state (h), you can traverse an edge (j) connecting (u) and (v) if and only if (w_j \ge h). Upon traversing this edge and arriving at vertex (v), the state parameter (h) updates to (\max(h, \mathrm{low}_j)). Let the walk end at some vertex (t). You must traverse at least one edge . The score of such a walk is defined as (\mathrm{val}_t + h_{start}). Note that we are interested in the sum of the final vertex value and the initial state parameter , not the final state parameter. For each starting vertex (s) from (1) to (n), calculate the maximum possible score achievable. If it is impossible to traverse any edge starting from some (s), output (-1) instead. 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 5\cdot 10^5, 0 \le m \le 5\cdot 10^5)) — the number of vertices and the number of edges. The second line of each test case contains (n) integers (\mathrm{val}_1, \mathrm{val}_2, \ldots, \mathrm{val}_n) ((1 \le \mathrm{val}_i \le 10^9)) — the values of the vertices. The next (m) lines describe the edges. The (j)-th line contains four integers (u_j, v_j, w_j, \mathrm{low}_j) ($$$1 \le u_j, v_j \le n, u_j \neq |
| Codeforces Round 1105 (Div. 1, Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 380364752 | qwef_ | E | June 27, 2026, 4:34 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 3609 | 401305600 | ||
| 380413323 | dumb_god | E | June 28, 2026, 4:43 a.m. | OK | C++20 (GCC 13-64) | TESTS | 31 | 1734 | 155750400 | ||
| 380409241 | Milkcat2009 | E | June 28, 2026, 3:15 a.m. | OK | C++20 (GCC 13-64) | TESTS | 31 | 1734 | 155750400 | ||
| 380377133 | szsyhh | E | June 27, 2026, 6:12 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 2156 | 128409600 | ||
| 380372038 | Thomas0802 | E | June 27, 2026, 5:19 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 2859 | 132300800 | ||
| 380372946 | Thomas0802 | E | June 27, 2026, 5:28 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 2921 | 130252800 | ||
| 380376682 | Adam_GS | E | June 27, 2026, 6:07 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 3046 | 366182400 | ||
| 380415416 | Ormlis | E | June 28, 2026, 5:22 a.m. | OK | C++20 (GCC 13-64) | TESTS | 31 | 3218 | 129433600 | ||
| 380372110 | PelicanPilot | E | June 27, 2026, 5:19 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 3406 | 162918400 | ||
| 380409264 | strapple | E | June 28, 2026, 3:15 a.m. | OK | C++20 (GCC 13-64) | TESTS | 31 | 3750 | 139366400 | ||
| 380368894 | thomaswmy | E | June 27, 2026, 4:55 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 4109 | 188518400 | ||
| 380417433 | thakurchinmay10 | E | June 28, 2026, 5:55 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 32 | 2187 | 182476800 | ||
| 380377839 | maroonrk | E | June 27, 2026, 6:20 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 31 | 2390 | 82124800 | ||
| 380377003 | maroonrk | E | June 27, 2026, 6:11 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 2890 | 88064000 | ||
| 380376477 | jeroenodb | E | June 27, 2026, 6:05 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 2953 | 411852800 | ||
| 380410533 | mhb2010 | E | June 28, 2026, 3:44 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 31 | 2968 | 411750400 | ||
| 380374277 | jeroenodb | E | June 27, 2026, 5:43 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 3078 | 411852800 | ||
| 380417189 | thomaswmy | E | June 28, 2026, 5:51 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 32 | 3250 | 437248000 | ||
| 380368568 | Farhod | E | June 27, 2026, 4:53 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 3265 | 253747200 | ||
| 380410740 | GCCCCCCC | E | June 28, 2026, 3:49 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 31 | 3281 | 434585600 | ||
| 380375643 | bitset | E | June 27, 2026, 5:57 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 3296 | 210329600 | ||
| 380401212 | d11maan | E | June 27, 2026, 10:51 p.m. | OK | Go | TESTS | 31 | 4562 | 1057280000 | ||
| 380403623 | sansen | E | June 28, 2026, 12:23 a.m. | OK | Rust 2021 | TESTS | 31 | 2671 | 115097600 | ||
| 380403248 | sansen | E | June 28, 2026, 12:06 a.m. | OK | Rust 2021 | TESTS | 31 | 4312 | 121139200 | ||
| 380368635 | sansen | E | June 27, 2026, 4:53 p.m. | OK | Rust 2021 | TESTS | 30 | 4687 | 121139200 |
Back to search problems