Codeforces Round 958 (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
1988 Codeforces Round 958 (Div. 2) FINISHED False 7200 16125863 July 15, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 5128 ) D The Omnipotent Monster Killer PROGRAMMING brute force dp trees

B'You, the monster killer, want to kill a group of monsters. The monsters are on a tree with n vertices. On vertex with number i ( 1 <= i <= n ), there is a monster with a_i attack points. You want to battle with monsters for 10^{100} rounds. In each round, the following happens in order: There is a restriction: in one round, you cannot kill two monsters that are directly connected by an edge. If you choose what monsters to attack optimally, what is the smallest health decrement you can have after all rounds? Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^4 ). Description of the test cases follows. The first line of each test case contains an integer n ( 1 <= n <= 3 cdot 10^5 ). The second line of each test case contains n integers a_1, ldots,a_n ( 1 <= a_i <= 10^{12} ). The following n-1 lines each contain two integers x,y ( 1 <= x,y <= n ), denoting an edge on the tree connecting vertex x and y . It is guaranteed that the sum of n over all test cases does not exceed 3 cdot 10^5 . For each test case, print one integer: the minimum possible health decrement. In the first test case, an optimal sequence of operations would be: The total health decrement is 10^{12} . In the second test case, an optimal sequence of operations would be: The total health decrement is 193 . In the third test case, an optimal sequence of operations would be: The total health decrement is 57 . '...

Tutorials

Editorial of Codeforces Round 958 (Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
270800165 lishujia090623 D July 16, 2024, 3:18 a.m. OK C++14 (GCC 6-32) TESTS 34 327 36966400
270804299 fls233666 D July 16, 2024, 3:59 a.m. OK C++14 (GCC 6-32) TESTS 34 405 91955200
270790472 a_sad_soul D July 16, 2024, 1:39 a.m. OK C++14 (GCC 6-32) TESTS 34 421 153702400
270756767 CleverRaccoon D July 15, 2024, 6:34 p.m. OK C++14 (GCC 6-32) TESTS 34 468 90009600
270799855 gevenfeng D July 16, 2024, 3:15 a.m. OK C++14 (GCC 6-32) TESTS 34 483 171008000
270791511 Rombing D July 16, 2024, 1:50 a.m. OK C++14 (GCC 6-32) TESTS 34 499 82432000
270800707 lishujia090623 D July 16, 2024, 3:23 a.m. OK C++14 (GCC 6-32) TESTS 34 499 167219200
270745952 Rigel__ D July 15, 2024, 5:28 p.m. OK C++14 (GCC 6-32) TESTS 34 515 94515200
270751282 llzer D July 15, 2024, 5:56 p.m. OK C++14 (GCC 6-32) TESTS 34 530 72908800
270787902 llldddddd_ D July 16, 2024, 1:15 a.m. OK C++14 (GCC 6-32) TESTS 34 609 75161600
270794785 MintCat D July 16, 2024, 2:24 a.m. OK C++17 (GCC 7-32) TESTS 34 389 131993600
270796097 zrj66 D July 16, 2024, 2:38 a.m. OK C++17 (GCC 7-32) TESTS 34 405 96768000
270783257 zrj66 D July 16, 2024, 12:12 a.m. OK C++17 (GCC 7-32) TESTS 34 406 320102400
270793868 hzy99999 D July 16, 2024, 2:15 a.m. OK C++17 (GCC 7-32) TESTS 34 421 70246400
270792120 JoaoNunoCoelho D July 16, 2024, 1:57 a.m. OK C++17 (GCC 7-32) TESTS 34 436 54067200
270777469 SpinSpen D July 15, 2024, 10:22 p.m. OK C++17 (GCC 7-32) TESTS 34 467 52428800
270793616 Sparkle_Twilight D July 16, 2024, 2:12 a.m. OK C++17 (GCC 7-32) TESTS 34 467 77516800
270793557 lxsi D July 16, 2024, 2:12 a.m. OK C++17 (GCC 7-32) TESTS 34 467 77516800
270788019 KisakiTsukiyashiro D July 16, 2024, 1:16 a.m. OK C++17 (GCC 7-32) TESTS 34 468 76288000
270811823 serenipity11 D July 16, 2024, 5:22 a.m. OK C++17 (GCC 7-32) TESTS 34 468 86323200
270784218 d325 D July 16, 2024, 12:25 a.m. OK C++20 (GCC 13-64) TESTS 34 296 95129600
270804601 SMDS D July 16, 2024, 4:02 a.m. OK C++20 (GCC 13-64) TESTS 34 327 100044800
270791028 Heshu D July 16, 2024, 1:45 a.m. OK C++20 (GCC 13-64) TESTS 34 342 139571200
270791082 yanold D July 16, 2024, 1:46 a.m. OK C++20 (GCC 13-64) TESTS 34 343 148070400
270767767 kaiboy D July 15, 2024, 8:15 p.m. OK C++20 (GCC 13-64) TESTS 34 358 46387200
270788504 fishcathu. D July 16, 2024, 1:22 a.m. OK C++20 (GCC 13-64) TESTS 34 374 88371200
270748873 Lylova D July 15, 2024, 5:43 p.m. OK C++20 (GCC 13-64) TESTS 34 389 54681600
270806454 TheBestFromEast D July 16, 2024, 4:24 a.m. OK C++20 (GCC 13-64) TESTS 34 389 184729600
270804617 louisfghbvc D July 16, 2024, 4:02 a.m. OK C++20 (GCC 13-64) TESTS 34 390 75878400
270769139 ktxyz D July 15, 2024, 8:30 p.m. OK C++20 (GCC 13-64) TESTS 34 390 91955200
270811585 ArminArlert69 D July 16, 2024, 5:20 a.m. OK GNU C11 TESTS 34 327 36864000
270746966 pengin_2000 D July 15, 2024, 5:32 p.m. OK GNU C11 TESTS 34 1515 211660800
270755871 coder0687 D July 15, 2024, 6:28 p.m. OK Java 21 TESTS 34 921 203366400
270752762 FierteDeCeylan D July 15, 2024, 6:06 p.m. OK Java 21 TESTS 34 1014 61132800
270792465 Zhanzhe_Lee D July 16, 2024, 2:01 a.m. OK Java 21 TESTS 34 1233 167833600
270792401 Zhanzhe_Lee D July 16, 2024, 2 a.m. OK Java 21 TESTS 34 1375 316723200
270748160 man-ray D July 15, 2024, 5:39 p.m. OK Java 21 TESTS 34 1405 160972800
270746945 man-ray D July 15, 2024, 5:32 p.m. OK Java 21 TESTS 34 1468 168857600
270755731 Sudip809 D July 15, 2024, 6:26 p.m. OK Java 21 TESTS 34 1483 165376000
270781004 dzhi D July 15, 2024, 11:31 p.m. OK Java 21 TESTS 34 1483 244531200
270765295 SweetAsCocaine D July 15, 2024, 7:50 p.m. OK Java 21 TESTS 34 1546 214937600
270768787 BlizGale D July 15, 2024, 8:26 p.m. OK Java 21 TESTS 34 1624 522342400
270744913 yvbf D July 15, 2024, 5:23 p.m. OK Java 8 TESTS 34 1452 123289600
270747038 CipherSphinx_Raj D July 15, 2024, 5:33 p.m. OK Java 8 TESTS 34 1484 178278400
270747607 CipherSphinx_Raj D July 15, 2024, 5:36 p.m. OK Java 8 TESTS 34 1530 181964800
270761792 Sumitsingh7 D July 15, 2024, 7:16 p.m. OK Java 8 TESTS 34 1562 191897600
270768883 BlizGale D July 15, 2024, 8:27 p.m. OK Java 8 TESTS 34 1624 433561600
270805676 kartik__sethi D July 16, 2024, 4:15 a.m. OK Java 8 TESTS 34 1640 185548800
270779937 x3mka D July 15, 2024, 11:10 p.m. OK PyPy 3-64 TESTS 34 1405 156262400
270785276 Taymyr D July 16, 2024, 12:40 a.m. OK PyPy 3-64 TESTS 34 1655 210636800
270813816 fatalerror D July 16, 2024, 5:41 a.m. OK PyPy 3-64 TESTS 34 1764 289894400
270785340 Taymyr D July 16, 2024, 12:41 a.m. OK PyPy 3-64 TESTS 34 1874 265728000
270761131 golomb D July 15, 2024, 7:10 p.m. OK PyPy 3-64 TESTS 34 1937 108646400
270795092 cy171 D July 16, 2024, 2:27 a.m. OK PyPy 3-64 TESTS 34 1953 148070400
270791138 smilences D July 16, 2024, 1:46 a.m. OK PyPy 3-64 TESTS 34 2265 248832000
270786742 mkawa2 D July 16, 2024, 1:01 a.m. OK PyPy 3-64 TESTS 34 2671 130252800
270746050 cybsbbb D July 15, 2024, 5:28 p.m. OK PyPy 3-64 TESTS 34 2827 262656000
270746641 Quick-One D July 15, 2024, 5:31 p.m. OK PyPy 3-64 TESTS 34 2984 149299200
270802189 toor D July 16, 2024, 3:38 a.m. OK Rust 2021 TESTS 34 359 162611200
270766098 Cheshulko D July 15, 2024, 7:58 p.m. OK Rust 2021 TESTS 34 1186 119091200
270752646 rusters D July 15, 2024, 6:05 p.m. OK Rust 2021 TESTS 34 1546 156569600
270790744 rli43 D July 16, 2024, 1:42 a.m. OK Rust 2021 TESTS 34 1562 274124800
270754937 ZigIsBestLanguage D July 15, 2024, 6:21 p.m. OK Rust 2021 TESTS 34 1577 156467200
270753613 rusters D July 15, 2024, 6:11 p.m. OK Rust 2021 TESTS 34 1577 156467200

remove filters

Back to search problems