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 |
|---|---|---|---|---|---|---|
| 2114 | Codeforces Round 1027 (Div. 3) | FINISHED | False | 8100 | 28135523 | May 26, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 13931 ) | E | Kirei Attacks the Estate | PROGRAMMING | dfs and similar dp trees |
Once, Kirei stealthily infiltrated the trap-filled estate of the Ainzbern family but was discovered by Kiritugu's familiar. Assessing his strength, Kirei decided to retreat. The estate is represented as a tree with (n) vertices, with the root at vertex (1). Each vertex of the tree has a number (a_i) recorded, which represents the danger of vertex (i). Recall that a tree is a connected undirected graph without cycles. For a successful retreat, Kirei must compute the threat value for each vertex. The threat of a vertex is equal to the maximum alternating sum along the vertical path starting from that vertex. The alternating sum along the vertical path starting from vertex (i) is defined as (a_i - a_{p_i} + a_{p_{p_i}} - \ldots), where (p_i) is the parent of vertex (i) on the path to the root (to vertex (1)). For example, in the tree below, vertex (4) has the following vertical paths: (4) with an alternating sum of (a_4 = 6); (4, 3) with an alternating sum of (a_4 - a_3 = 6 - 2 = 4); (4, 3, 2) with an alternating sum of (a_4 - a_3 + a_2 = 6 - 2 + 5 = 9); (4, 3, 2, 1) with an alternating sum of (a_4 - a_3 + a_2 - a_1 = 6 - 2 + 5 - 4 = 5). Help Kirei compute the threat values for all vertices and escape the estate. The first line contains an integer (t) ((1 \le t \le 10^4)) — the number of test cases. The following describes the test cases. The first line contains an integer (n) ((2 \le n \le 2 \cdot 10^5)) — the number of vertices in the tree. The second line contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \le a_i \le 10^9)) — the dangers of the vertices. The next (n - 1) lines contain the numbers (v, u) ((1 \le v, u \le n), (v \neq u)) — the description of the edges of the tree. It is guaranteed that the sum of (n) across all test cases does not exceed (2 \cdot 10^5). It is also guaranteed that the given set of edges forms a tr |
| 143268 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 321684255 | IRacle | E | May 27, 2025, 5:14 p.m. | OK | C# 10 | TESTS | 10 | 546 | 68300800 | ||
| 321616276 | gezhizhou | E | May 27, 2025, 9:07 a.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 249 | 7270400 | ||
| 321719317 | nuchenghao | E | May 28, 2025, 3:19 a.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 249 | 10240000 | ||
| 321619531 | TEoS | E | May 27, 2025, 9:28 a.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 265 | 8499200 | ||
| 321674876 | Badhon_1 | E | May 27, 2025, 4 p.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 265 | 10649600 | ||
| 321714696 | roadbike80 | E | May 28, 2025, 2 a.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 265 | 11571200 | ||
| 321582397 | accuber | E | May 27, 2025, 4:22 a.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 265 | 18227200 | ||
| 321654699 | LKB0528 | E | May 27, 2025, 1:32 p.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 265 | 23756800 | ||
| 321657553 | LSL_666 | E | May 27, 2025, 1:52 p.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 280 | 7372800 | ||
| 321584569 | TheSupremacy55 | E | May 27, 2025, 4:45 a.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 280 | 7680000 | ||
| 321718248 | devecent | E | May 28, 2025, 3:02 a.m. | OK | C++17 (GCC 7-32) | TESTS | 10 | 280 | 8908800 | ||
| 321583262 | qcw666666 | E | May 27, 2025, 4:31 a.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 156 | 21094400 | ||
| 321666072 | rlaaa | E | May 27, 2025, 2:54 p.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 186 | 15257600 | ||
| 321640073 | codehjkun | E | May 27, 2025, 11:54 a.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 187 | 21504000 | ||
| 321621271 | Tianyu_miao | E | May 27, 2025, 9:40 a.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 202 | 13516800 | ||
| 321737245 | ShaikAbdulSameer | E | May 28, 2025, 5:59 a.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 218 | 14336000 | ||
| 321721128 | fadi__ | E | May 28, 2025, 3:48 a.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 218 | 14745600 | ||
| 321672341 | brownfox2k6 | E | May 27, 2025, 3:40 p.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 218 | 14745600 | ||
| 321654161 | LuvSran | E | May 27, 2025, 1:28 p.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 218 | 14745600 | ||
| 321650437 | ivaziva | E | May 27, 2025, 1:03 p.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 218 | 21196800 | ||
| 321585651 | Ichinoseyang | E | May 27, 2025, 4:56 a.m. | OK | C++20 (GCC 13-64) | TESTS | 10 | 233 | 12083200 | ||
| 321589057 | redzxx | E | May 27, 2025, 5:28 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 186 | 19865600 | ||
| 321665721 | OxyTheCrack | E | May 27, 2025, 2:51 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 187 | 10956800 | ||
| 321585524 | zero_chenhy | E | May 27, 2025, 4:55 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 187 | 50483200 | ||
| 321585309 | zero_chenhy | E | May 27, 2025, 4:52 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 202 | 50380800 | ||
| 321682034 | Pratyushdumdumb | E | May 27, 2025, 4:56 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 218 | 10547200 | ||
| 321695416 | official-ashutosh | E | May 27, 2025, 6:59 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 218 | 13312000 | ||
| 321721999 | Applequick | E | May 28, 2025, 4:03 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 218 | 14131200 | ||
| 321581139 | 7plus6 | E | May 27, 2025, 4:08 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 218 | 15667200 | ||
| 321690599 | DarkSun | E | May 27, 2025, 6:09 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 218 | 16998400 | ||
| 321640788 | tooourist | E | May 27, 2025, 11:58 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 10 | 218 | 17920000 | ||
| 321586595 | KL2400031478 | E | May 27, 2025, 5:06 a.m. | OK | GNU C11 | TESTS | 10 | 984 | 12083200 | ||
| 321678626 | lyongwolf | E | May 27, 2025, 4:30 p.m. | OK | Java 21 | TESTS | 10 | 531 | 17920000 | ||
| 321640745 | ash432 | E | May 27, 2025, 11:58 a.m. | OK | Java 21 | TESTS | 10 | 733 | 50278400 | ||
| 321681303 | resnik | E | May 27, 2025, 4:50 p.m. | OK | Java 21 | TESTS | 10 | 796 | 43929600 | ||
| 321639995 | Kovi_coder | E | May 27, 2025, 11:53 a.m. | OK | Java 21 | TESTS | 10 | 811 | 44032000 | ||
| 321646205 | ayush_dixit_iit_bhu | E | May 27, 2025, 12:35 p.m. | OK | Java 21 | TESTS | 10 | 827 | 59187200 | ||
| 321640468 | parni6ka0 | E | May 27, 2025, 11:56 a.m. | OK | Java 21 | TESTS | 10 | 890 | 53964800 | ||
| 321651754 | _TokaiTeio_ | E | May 27, 2025, 1:12 p.m. | OK | Java 21 | TESTS | 10 | 905 | 58572800 | ||
| 321700803 | iamalizaidi | E | May 27, 2025, 8:06 p.m. | OK | Java 21 | TESTS | 10 | 937 | 44544000 | ||
| 321686380 | Diptarshi | E | May 27, 2025, 5:32 p.m. | OK | Java 21 | TESTS | 10 | 984 | 39424000 | ||
| 321686127 | Diptarshi | E | May 27, 2025, 5:30 p.m. | OK | Java 21 | TESTS | 10 | 999 | 40448000 | ||
| 321710124 | Destroyer0069 | E | May 27, 2025, 11:45 p.m. | OK | Java 8 | TESTS | 10 | 686 | 60211200 | ||
| 321585042 | kasiru_69 | E | May 27, 2025, 4:50 a.m. | OK | Java 8 | TESTS | 10 | 952 | 29286400 | ||
| 321667308 | Sumitsingh7 | E | May 27, 2025, 3:03 p.m. | OK | Java 8 | TESTS | 10 | 1046 | 97587200 | ||
| 321665588 | satyams_9001 | E | May 27, 2025, 2:50 p.m. | OK | Java 8 | TESTS | 10 | 1046 | 97587200 | ||
| 321719811 | NischayCodes | E | May 28, 2025, 3:27 a.m. | OK | Java 8 | TESTS | 10 | 1640 | 33587200 | ||
| 321645932 | i_love_ram | E | May 27, 2025, 12:33 p.m. | OK | Java 8 | TESTS | 10 | 1796 | 33792000 | ||
| 321733455 | Bhuvan_sai | E | May 28, 2025, 5:22 a.m. | OK | Java 8 | TESTS | 10 | 1859 | 86016000 | ||
| 321626508 | yuki61256 | E | May 27, 2025, 10:17 a.m. | OK | PyPy 3-64 | TESTS | 10 | 421 | 42700800 | ||
| 321665389 | linhcooocaaa | E | May 27, 2025, 2:49 p.m. | OK | PyPy 3-64 | TESTS | 10 | 452 | 41574400 | ||
| 321695450 | bengold10 | E | May 27, 2025, 6:59 p.m. | OK | PyPy 3-64 | TESTS | 10 | 515 | 46899200 | ||
| 321624038 | ChickenTamer | E | May 27, 2025, 9:59 a.m. | OK | PyPy 3-64 | TESTS | 10 | 562 | 54067200 | ||
| 321700736 | mamine27 | E | May 27, 2025, 8:05 p.m. | OK | PyPy 3-64 | TESTS | 10 | 562 | 73216000 | ||
| 321623710 | ChickenTamer | E | May 27, 2025, 9:57 a.m. | OK | PyPy 3-64 | TESTS | 10 | 609 | 60723200 | ||
| 321696413 | kidus72 | E | May 27, 2025, 7:10 p.m. | OK | PyPy 3-64 | TESTS | 10 | 624 | 74547200 | ||
| 321710332 | monocrap | E | May 27, 2025, 11:52 p.m. | OK | PyPy 3-64 | TESTS | 10 | 655 | 60416000 | ||
| 321588264 | taowdy | E | May 27, 2025, 5:21 a.m. | OK | PyPy 3-64 | TESTS | 10 | 702 | 41779200 | ||
| 321646712 | i_love_ram | E | May 27, 2025, 12:39 p.m. | OK | PyPy 3-64 | TESTS | 10 | 702 | 48537600 | ||
| 321667537 | huangjiajing | E | May 27, 2025, 3:05 p.m. | OK | Python 3 | TESTS | 10 | 780 | 125952000 | ||
| 321666387 | CodingNinja007 | E | May 27, 2025, 2:56 p.m. | OK | Python 3 | TESTS | 10 | 859 | 73728000 | ||
| 321654410 | Toilet_Paper | E | May 27, 2025, 1:30 p.m. | OK | Python 3 | TESTS | 10 | 874 | 73932800 | ||
| 321623213 | average_engineer | E | May 27, 2025, 9:54 a.m. | OK | Python 3 | TESTS | 10 | 890 | 74035200 | ||
| 321654105 | Toilet_Paper | E | May 27, 2025, 1:28 p.m. | OK | Python 3 | TESTS | 10 | 921 | 73932800 | ||
| 321630542 | ___a_s_1_2___ | E | May 27, 2025, 10:47 a.m. | OK | Python 3 | TESTS | 10 | 937 | 73932800 | ||
| 321647395 | ayushdreams147 | E | May 27, 2025, 12:43 p.m. | OK | Python 3 | TESTS | 10 | 983 | 62976000 | ||
| 321621033 | HaisTous | E | May 27, 2025, 9:39 a.m. | OK | Python 3 | TESTS | 10 | 1062 | 68300800 | ||
| 321663646 | dima1857 | E | May 27, 2025, 2:36 p.m. | OK | Python 3 | TESTS | 10 | 1249 | 65126400 | ||
| 321654771 | ksuganthy | E | May 27, 2025, 1:32 p.m. | OK | Python 3 | TESTS | 10 | 1280 | 82739200 | ||
| 321652054 | hjklyuyu | E | May 27, 2025, 1:14 p.m. | OK | Rust 2021 | TESTS | 10 | 217 | 39219200 | ||
| 321652894 | Ming_Xu | E | May 27, 2025, 1:20 p.m. | OK | Rust 2021 | TESTS | 10 | 234 | 34816000 | ||
| 321643606 | DanielAnker | E | May 27, 2025, 12:18 p.m. | OK | Rust 2021 | TESTS | 10 | 281 | 22323200 | ||
| 321664791 | davidmiheev | E | May 27, 2025, 2:45 p.m. | OK | Rust 2021 | TESTS | 10 | 359 | 52940800 | ||
| 321583018 | silicalet | E | May 27, 2025, 4:29 a.m. | OK | Rust 2021 | TESTS | 10 | 453 | 74649600 |
Back to search problems