Codeforces Round 627 (Div. 3)

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
1324 Codeforces Round 627 (Div. 3) FINISHED False 7200 147804899 March 12, 2020, 1:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 10173 ) F Maximum White Subtree PROGRAMMING dfs and similar dp graphs trees

B'You are given a tree consisting of n vertices. A tree is a connected undirected graph with n-1 edges. Each vertex v of this tree has a color assigned to it ( a_v = 1 if the vertex v is white and 0 if the vertex v is black). You have to solve the following problem for each vertex v : what is the maximum difference between the number of white and the number of black vertices you can obtain if you choose some subtree of the given tree that contains the vertex v ? The subtree of the tree is the connected subgraph of the given tree. More formally, if you choose the subtree that contains cnt_w white vertices and cnt_b black vertices, you have to maximize cnt_w - cnt_b . The first line of the input contains one integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of vertices in the tree. The second line of the input contains n integers a_1, a_2, ... , a_n ( 0 <= a_i <= 1 ), where a_i is the color of the i -th vertex. Each of the next n-1 lines describes an edge of the tree. Edge i is denoted by two integers u_i and v_i , the labels of vertices it connects (1 <= u_i, v_i <= n, u_i ne v_i ). It is guaranteed that the given edges form a tree. Print n integers res_1, res_2, ... , res_n , where res_i is the maximum possible difference between the number of white and black vertices in some subtree that contains the vertex i . The first example is shown below: The black vertices have bold borders. In the second example, the best subtree for vertices 2, 3 and 4 are vertices 2, 3 and 4 correspondingly. And the best subtree for the vertex 1 is the subtree consisting of vertices 1 and 3 . '...

Tutorials

Codeforces Round #627 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
73384472 _lys_Ce F March 16, 2020, 6:21 a.m. OK GNU C++11 TESTS 56 93 8499200
73384458 luogu_bot2 F March 16, 2020, 6:21 a.m. OK GNU C++11 TESTS 56 93 8499200
73180553 wqst F March 14, 2020, 1:47 a.m. OK GNU C++11 TESTS 56 93 13107200
73461258 lin_rany F March 17, 2020, 7:17 a.m. OK GNU C++11 TESTS 56 93 25190400
73191766 GOODer F March 14, 2020, 6:46 a.m. OK GNU C++11 TESTS 56 108 10956800
73127633 TYGZ F March 13, 2020, 7:56 a.m. OK GNU C++11 TESTS 56 108 12288000
73306141 lx_zjk F March 15, 2020, 5:53 a.m. OK GNU C++11 TESTS 56 109 7987200
73214966 KJGKMTZB F March 14, 2020, 12:53 p.m. OK GNU C++11 TESTS 56 109 8601600
73118028 froggyzhang F March 13, 2020, 4:31 a.m. OK GNU C++11 TESTS 56 109 11571200
73127696 TYGL F March 13, 2020, 7:57 a.m. OK GNU C++11 TESTS 56 109 12288000
73386895 Lezedary_sandwich F March 16, 2020, 7:08 a.m. OK GNU C++14 TESTS 56 171 15974400
73450167 vjudge4 F March 17, 2020, 2:58 a.m. OK GNU C++14 TESTS 56 187 11980800
73478812 lucifer17 F March 17, 2020, 11:41 a.m. OK GNU C++14 TESTS 56 187 13107200
73299894 tsingcbx F March 15, 2020, 3:40 a.m. OK GNU C++14 TESTS 56 202 13516800
73217487 luogu_bot4 F March 14, 2020, 1:28 p.m. OK GNU C++14 TESTS 56 202 13516800
73394962 tokitsukaze F March 16, 2020, 9:26 a.m. OK GNU C++14 TESTS 56 202 16588800
73131026 vjudge4 F March 13, 2020, 9:04 a.m. OK GNU C++14 TESTS 56 217 9523200
73082760 _JJ F March 12, 2020, 3:24 p.m. OK GNU C++14 TESTS 56 217 12288000
73115183 jinhb5519 F March 13, 2020, 3:13 a.m. OK GNU C++14 TESTS 56 217 17100800
73082394 JackandJackson F March 12, 2020, 3:21 p.m. OK GNU C++14 TESTS 56 218 12288000
73083302 _andyli F March 12, 2020, 3:29 p.m. OK GNU C++17 TESTS 56 155 16896000
73332758 cjhxqdt F March 15, 2020, 12:18 p.m. OK GNU C++17 TESTS 56 187 14233600
73415405 haha020 F March 16, 2020, 2:25 p.m. OK GNU C++17 TESTS 56 202 12288000
73296545 Ruins F March 15, 2020, 1:51 a.m. OK GNU C++17 TESTS 56 202 12288000
73132245 xuyifeng F March 13, 2020, 9:26 a.m. OK GNU C++17 TESTS 56 202 12288000
73082160 studymademehappy F March 12, 2020, 3:19 p.m. OK GNU C++17 TESTS 56 202 12288000
73483928 rqdmap F March 17, 2020, 12:31 p.m. OK GNU C++17 TESTS 56 202 13107200
73631819 CUSTStein F March 19, 2020, 7:32 a.m. OK GNU C++17 TESTS 56 202 14336000
73092032 liyunfan1223 F March 12, 2020, 5:16 p.m. OK GNU C++17 TESTS 56 217 10342400
73618446 17041020309 F March 19, 2020, 2:34 a.m. OK GNU C++17 TESTS 56 217 10752000
73127382 synapse F March 13, 2020, 7:51 a.m. OK Go TESTS 56 498 24473600
73211968 Anonymous F March 14, 2020, 12:09 p.m. OK Java 11 TESTS 56 327 17510400
73153735 avijit_agarwal F March 13, 2020, 4:21 p.m. OK Java 11 TESTS 56 592 51097600
73447448 jaynils F March 17, 2020, 1:09 a.m. OK Java 11 TESTS 56 670 41676800
73080790 sarthakmanna F March 12, 2020, 3:09 p.m. OK Java 11 TESTS 56 670 56627200
73312554 jst_forfun F March 15, 2020, 7:32 a.m. OK Java 11 TESTS 56 701 47923200
73450293 sakt_coder F March 17, 2020, 3:02 a.m. OK Java 11 TESTS 56 716 44748800
73507504 polyakoff F March 17, 2020, 4:57 p.m. OK Java 11 TESTS 56 732 47616000
73097527 its_aks_ulure F March 12, 2020, 6:37 p.m. OK Java 11 TESTS 56 764 61132800
73127832 GiantTornado F March 13, 2020, 8 a.m. OK Java 11 TESTS 56 779 48230400
73102808 noahlewis.ca F March 12, 2020, 8:12 p.m. OK Java 11 TESTS 56 810 43827200
73209499 In_The_Name_Of_Love F March 14, 2020, 11:32 a.m. OK Java 8 TESTS 56 264 17100800
73171022 Ahmed_Diab F March 13, 2020, 8:09 p.m. OK Java 8 TESTS 56 265 13926400
73356574 Taran_1407 F March 15, 2020, 5:29 p.m. OK Java 8 TESTS 56 312 17612800
73207104 manish_98 F March 14, 2020, 10:54 a.m. OK Java 8 TESTS 56 498 49664000
73084133 Whiplash99 F March 12, 2020, 3:37 p.m. OK Java 8 TESTS 56 499 53043200
73085891 Global_Elite F March 12, 2020, 3:56 p.m. OK Java 8 TESTS 56 530 54886400
73194406 KharYusuf F March 14, 2020, 7:31 a.m. OK Java 8 TESTS 56 561 51302400
73426673 YahiaSherif F March 16, 2020, 5:07 p.m. OK Java 8 TESTS 56 639 36352000
73319909 yaoct F March 15, 2020, 9:21 a.m. OK Java 8 TESTS 56 639 36556800
73106570 kostasanemozalis F March 12, 2020, 9:43 p.m. OK Java 8 TESTS 56 639 37785600
73128354 Spheniscine F March 13, 2020, 8:10 a.m. OK Kotlin TESTS 56 607 103526400
73100294 SlavaG F March 12, 2020, 7:24 p.m. OK Kotlin TESTS 56 748 63180800
73176293 ostroumov F March 13, 2020, 10:18 p.m. OK Kotlin TESTS 56 873 58880000
73178032 Tlatoani F March 13, 2020, 11:29 p.m. OK Kotlin TESTS 56 1138 78950400
73197413 YESMAths F March 14, 2020, 8:21 a.m. OK Kotlin TESTS 56 1419 46694400
73523185 Kostya F March 17, 2020, 8:28 p.m. OK Kotlin TESTS 56 1981 47923200
73183992 strelas F March 14, 2020, 4:02 a.m. OK Kotlin TESTS 56 1996 97484800
73198284 seh631638554 F March 14, 2020, 8:35 a.m. OK MS C++ TESTS 56 186 11161600
73500909 vjudge1 F March 17, 2020, 3:40 p.m. OK MS C++ TESTS 56 218 13926400
73795303 vjudge5 F March 20, 2020, 1:13 p.m. OK MS C++ TESTS 56 249 12697600
73764770 vjudge1 F March 20, 2020, 6:13 a.m. OK MS C++ TESTS 56 265 12697600
73629591 acrux F March 19, 2020, 7 a.m. OK MS C++ TESTS 56 280 12902400
73111492 vjudge3 F March 13, 2020, 1:01 a.m. OK MS C++ TESTS 56 358 40550400
73533253 vjudge5 F March 18, 2020, 2:09 a.m. OK MS C++ TESTS 56 608 12697600
73620214 Monotonic F March 19, 2020, 3:38 a.m. OK MS C++ 2017 TESTS 56 233 9113600
73165315 systemcalled F March 13, 2020, 6:41 p.m. OK MS C++ 2017 TESTS 56 311 10240000
73180979 DOUBLEFULL F March 14, 2020, 2:08 a.m. OK MS C++ 2017 TESTS 56 343 12390400
73114886 vjudge4 F March 13, 2020, 3:04 a.m. OK MS C++ 2017 TESTS 56 358 11878400
73082634 youx F March 12, 2020, 3:23 p.m. OK MS C++ 2017 TESTS 56 389 17305600
73114843 vjudge4 F March 13, 2020, 3:03 a.m. OK MS C++ 2017 TESTS 56 436 11878400
73191223 suun F March 14, 2020, 6:37 a.m. OK MS C++ 2017 TESTS 56 639 12288000
73359006 danilgrig F March 15, 2020, 6:05 p.m. OK MS C++ 2017 TESTS 56 639 12902400
73095898 60D9 F March 12, 2020, 6:11 p.m. OK MS C++ 2017 TESTS 56 685 12185600
73557785 darshan_r F March 18, 2020, 9:57 a.m. OK MS C++ 2017 TESTS 56 685 13926400
73280987 YESMAths F March 14, 2020, 6:54 p.m. OK PyPy 2 TESTS 56 717 38912000
73201342 YESMAths F March 14, 2020, 9:23 a.m. OK PyPy 2 TESTS 56 1684 31232000
73509507 Mirali F March 17, 2020, 5:19 p.m. OK PyPy 3 TESTS 56 888 43212800
73158834 aberent F March 13, 2020, 5:22 p.m. OK PyPy 3 TESTS 56 1014 69324800
73184057 wattaihei F March 14, 2020, 4:03 a.m. OK PyPy 3 TESTS 56 1028 38502400
73297208 takakin F March 15, 2020, 2:18 a.m. OK PyPy 3 TESTS 56 1060 36761600
73202559 cftt F March 14, 2020, 9:41 a.m. OK PyPy 3 TESTS 56 1106 47616000
73088578 Kiri8128 F March 12, 2020, 4:28 p.m. OK PyPy 3 TESTS 56 1107 36659200
73644999 nikeshthapa255 F March 19, 2020, 10:45 a.m. OK PyPy 3 TESTS 56 1231 50073600
73086105 neterukun F March 12, 2020, 3:58 p.m. OK PyPy 3 TESTS 56 1232 60313600
73086705 aberent F March 12, 2020, 4:04 p.m. OK PyPy 3 TESTS 56 1247 69939200
73646027 nikeshthapa255 F March 19, 2020, 11 a.m. OK PyPy 3 TESTS 56 1310 75059200
73415490 renjied F March 16, 2020, 2:26 p.m. OK Python 2 TESTS 56 1980 87552000
73111914 earlgrey_yh F March 13, 2020, 1:17 a.m. OK Python 3 TESTS 56 1528 42086400
73334200 BringItIn F March 15, 2020, 12:36 p.m. OK Python 3 TESTS 56 1559 149708800
73081062 nagitaosu F March 12, 2020, 3:11 p.m. OK Python 3 TESTS 56 1606 27648000
73559877 vk_76 F March 18, 2020, 10:26 a.m. OK Python 3 TESTS 56 1606 180736000
73394988 twbbbb F March 16, 2020, 9:27 a.m. OK Python 3 TESTS 56 1637 145715200
73739232 crysoberil F March 19, 2020, 7:43 p.m. OK Python 3 TESTS 56 1715 39628800
73112147 mkawa2 F March 13, 2020, 1:26 a.m. OK Python 3 TESTS 56 1731 33792000
73521048 draj9798 F March 17, 2020, 7:46 p.m. OK Python 3 TESTS 56 1886 180531200
73095384 ArtoLord F March 12, 2020, 6:02 p.m. OK Python 3 TESTS 56 1996 28979200
73415412 renjied F March 16, 2020, 2:25 p.m. OK Python 3 TESTS 56 1996 81203200
73201131 sansen F March 14, 2020, 9:20 a.m. OK Rust TESTS 56 234 20172800
73084495 rustafarian F March 12, 2020, 3:40 p.m. OK Rust TESTS 56 311 14848000
73088034 akiradeveloper F March 12, 2020, 4:20 p.m. OK Rust TESTS 56 795 69529600
73088305 akiradeveloper F March 12, 2020, 4:24 p.m. OK Rust TESTS 56 826 64614400

remove filters

Back to search problems