Codeforces Global Round 18

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
1615 Codeforces Global Round 18 FINISHED False 9000 96823463 Dec. 24, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1527 ) E Purple Crayon PROGRAMMING dp games greedy math trees

B"Two players, Red and Blue, are at it again, and this time they're playing with crayons! The mischievous duo is now vandalizing a rooted tree, by coloring the nodes while playing their favorite game. The game works as follows: there is a tree of size n , rooted at node 1 , where each node is initially white. Red and Blue get one turn each. Red goes first. In Red's turn, he can do the following operation any number of times: Then, it's Blue's turn. Blue can do the following operation any number of times: After the two turns, the score of the game is determined as follows: let w be the number of white nodes, r be the number of red nodes, and b be the number of blue nodes. The score of the game is w cdot (r - b) . Red wants to maximize this score, and Blue wants to minimize it. If both players play optimally, what will the final score of the game be? The first line contains two integers n and k ( 2 <= n <= 2 cdot 10^5 ; 1 <= k <= n ) -- the number of vertices in the tree and the maximum number of red nodes. Next n - 1 lines contains description of edges. The i -th line contains two space separated integers u_i and v_i ( 1 <= u_i, v_i <= n ; u_i neq v_i ) -- the i -th edge of the tree. It's guaranteed that given edges form a tree. Print one integer -- the resulting score if both Red and Blue play optimally. In the first test case, the optimal strategy is as follows: In the second test case, the optimal strategy is as follows: For the third test case: The score of the game is 4 cdot (2 - 1) = 4 . "...

Tutorials

Global Round 18 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
140512208 Toby-Shi E Dec. 24, 2021, 6:04 p.m. OK GNU C++14 TESTS 61 109 13516800
140540629 Larry0101 E Dec. 25, 2021, 5:11 a.m. OK GNU C++14 TESTS 64 124 51712000
140501791 How_old_are_you E Dec. 24, 2021, 4:49 p.m. OK GNU C++14 TESTS 59 156 13824000
140493671 _Guoyh_ E Dec. 24, 2021, 4:19 p.m. OK GNU C++14 TESTS 59 171 12390400
140499383 ljyljy12138 E Dec. 24, 2021, 4:40 p.m. OK GNU C++14 TESTS 59 171 14336000
140529907 wyzwyz E Dec. 25, 2021, 12:28 a.m. OK GNU C++14 TESTS 63 171 15974400
140507755 hyta4982 E Dec. 24, 2021, 5:25 p.m. OK GNU C++14 TESTS 60 171 16076800
140521165 PartyJindal E Dec. 24, 2021, 7:53 p.m. OK GNU C++14 TESTS 61 186 21094400
140540174 devout E Dec. 25, 2021, 5:04 a.m. OK GNU C++14 TESTS 64 187 14540800
140507863 hyta4982 E Dec. 24, 2021, 5:25 p.m. OK GNU C++14 TESTS 60 187 16076800
140510341 fallleaves01 E Dec. 24, 2021, 5:44 p.m. OK GNU C++17 TESTS 61 78 13107200
140517766 hyabc E Dec. 24, 2021, 7:05 p.m. OK GNU C++17 TESTS 61 155 37785600
140531432 juju054 E Dec. 25, 2021, 1:31 a.m. OK GNU C++17 TESTS 63 171 18329600
140520268 snuphy E Dec. 24, 2021, 7:39 p.m. OK GNU C++17 TESTS 61 186 15462400
140534337 AhoCorasick E Dec. 25, 2021, 2:56 a.m. OK GNU C++17 TESTS 63 186 17715200
140525110 islingr E Dec. 24, 2021, 9:12 p.m. OK GNU C++17 TESTS 63 187 11776000
140514115 ZI__MA E Dec. 24, 2021, 6:24 p.m. OK GNU C++17 TESTS 61 187 16076800
140535841 psc233 E Dec. 25, 2021, 3:36 a.m. OK GNU C++17 TESTS 63 187 19046400
140508263 abcdhhhh E Dec. 24, 2021, 5:27 p.m. OK GNU C++17 TESTS 60 202 19353600
140526448 LeVladiator E Dec. 24, 2021, 9:51 p.m. OK GNU C++17 TESTS 63 202 19558400
140502521 SampsonYW E Dec. 24, 2021, 4:51 p.m. OK GNU C++17 (64) TESTS 59 156 233779200
140536341 narangkay E Dec. 25, 2021, 3:49 a.m. OK GNU C++17 (64) TESTS 63 170 24780800
140508333 wyyxhjth E Dec. 24, 2021, 5:28 p.m. OK GNU C++17 (64) TESTS 60 171 25292800
140515157 kotatsugame E Dec. 24, 2021, 6:34 p.m. OK GNU C++17 (64) TESTS 61 171 29900800
140536222 xiaoziyao E Dec. 25, 2021, 3:46 a.m. OK GNU C++17 (64) TESTS 63 171 30822400
140510397 rgnerdplayer E Dec. 24, 2021, 5:45 p.m. OK GNU C++17 (64) TESTS 61 171 33382400
140509705 ksun48 E Dec. 24, 2021, 5:38 p.m. OK GNU C++17 (64) TESTS 61 187 30822400
140517807 Macdu E Dec. 24, 2021, 7:06 p.m. OK GNU C++17 (64) TESTS 61 187 33894400
140508214 tsukiko_tsutsukakushi E Dec. 24, 2021, 5:27 p.m. OK GNU C++17 (64) TESTS 60 187 39833600
140509104 jakao E Dec. 24, 2021, 5:33 p.m. OK GNU C++17 (64) TESTS 60 202 27136000
140531741 czhang2718 E Dec. 25, 2021, 1:41 a.m. OK GNU C++20 (64) TESTS 63 171 29081600
140529017 couplefire E Dec. 24, 2021, 11:40 p.m. OK GNU C++20 (64) TESTS 63 171 29491200
140542553 orzorz_moeDzW E Dec. 25, 2021, 5:38 a.m. OK GNU C++20 (64) TESTS 64 171 32972800
140498802 ajpiano E Dec. 24, 2021, 4:38 p.m. OK GNU C++20 (64) TESTS 59 171 34201600
140528837 izhang05 E Dec. 24, 2021, 11:30 p.m. OK GNU C++20 (64) TESTS 63 186 19046400
140509822 ALILILILILI-KHAN E Dec. 24, 2021, 5:39 p.m. OK GNU C++20 (64) TESTS 61 186 31027200
140529029 nizamoff E Dec. 24, 2021, 11:40 p.m. OK GNU C++20 (64) TESTS 63 187 16896000
140509787 brunovsky E Dec. 24, 2021, 5:39 p.m. OK GNU C++20 (64) TESTS 61 187 19660800
140497324 vladvlad00 E Dec. 24, 2021, 4:32 p.m. OK GNU C++20 (64) TESTS 59 187 32972800
140515122 Theresa_Apocalypse E Dec. 24, 2021, 6:34 p.m. OK GNU C++20 (64) TESTS 61 187 36556800
140518031 Dukkha E Dec. 24, 2021, 7:09 p.m. OK Java 11 TESTS 61 795 21708800
140509025 YahiaSherif E Dec. 24, 2021, 5:33 p.m. OK Java 11 TESTS 60 1216 186982400
140527241 Magikarp1 E Dec. 24, 2021, 10:18 p.m. OK Java 11 TESTS 63 1637 232960000
140508902 fetetriste E Dec. 24, 2021, 5:32 p.m. OK Java 8 TESTS 60 514 47820800
140512476 NighTurs E Dec. 24, 2021, 6:07 p.m. OK Java 8 TESTS 61 623 75980800
140506170 jxin31415 E Dec. 24, 2021, 5:04 p.m. OK Java 8 TESTS 59 935 106700800
140511336 AndreySiunov E Dec. 24, 2021, 5:55 p.m. OK Java 8 TESTS 61 951 79257600
140518298 MagentaCobra E Dec. 24, 2021, 7:12 p.m. OK Java 8 TESTS 61 1434 100249600
140492234 arvindf232 E Dec. 24, 2021, 4:15 p.m. OK Kotlin 1.4 TESTS 59 639 98406400
140534892 Agumon E Dec. 25, 2021, 3:12 a.m. OK MS C++ 2017 TESTS 63 218 44339200
140534849 bkifhr10 E Dec. 25, 2021, 3:10 a.m. OK MS C++ 2017 TESTS 63 218 44339200
140501131 ialakhtin E Dec. 24, 2021, 4:46 p.m. OK MS C++ 2017 TESTS 59 483 16998400
140505068 machine_solution E Dec. 24, 2021, 5:01 p.m. OK MS C++ 2017 TESTS 59 982 54169600
140513047 hxu10 E Dec. 24, 2021, 6:12 p.m. OK PyPy 3 TESTS 61 794 53043200
140513094 hxu10 E Dec. 24, 2021, 6:13 p.m. OK PyPy 3-64 TESTS 61 982 91340800
140520323 titia E Dec. 24, 2021, 7:40 p.m. OK PyPy 3-64 TESTS 61 1216 112947200
140501597 cocopalm E Dec. 24, 2021, 4:48 p.m. OK PyPy 3-64 TESTS 59 1325 143769600
140507897 titia E Dec. 24, 2021, 5:25 p.m. OK PyPy 3-64 TESTS 60 1465 108544000
140502653 chinerist E Dec. 24, 2021, 4:52 p.m. OK PyPy 3-64 TESTS 59 1918 155545600
140502907 misorin E Dec. 24, 2021, 4:53 p.m. OK PyPy 3-64 TESTS 59 1996 92160000

remove filters

Back to search problems