Codeforces Round 646 (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
1363 Codeforces Round 646 (Div. 2) FINISHED False 7200 146417111 May 31, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6912 ) E Tree Shuffling PROGRAMMING dfs and similar dp ds greedy trees 2000

B'Ashish has a tree consisting of n nodes numbered 1 to n rooted at node 1 . The i -th node in the tree has a cost a_i , and binary digit b_i is written in it. He wants to have binary digit c_i written in the i -th node in the end. To achieve this, he can perform the following operation any number of times: He wants to perform the operations in such a way that every node finally has the digit corresponding to its target. Help him find the minimum total cost he needs to spend so that after all the operations, every node u has digit c_u written in it, or determine that it is impossible. First line contains a single integer n (1 <= n <= 2 cdot 10^5) denoting the number of nodes in the tree. i -th line of the next n lines contains 3 space-separated integers a_i , b_i , c_i (1 <= q a_i <= q 10^9, 0 <= q b_i, c_i <= q 1) -- the cost of the i -th node, its initial digit and its goal digit. Each of the next n - 1 lines contain two integers u , v (1 <= q u, v <= q n, text{ } u ne v) , meaning that there is an edge between nodes u and v in the tree. Print the minimum total cost to make every node reach its target digit, and -1 if it is impossible. The tree corresponding to samples 1 and 2 are: In sample 1 , we can choose node 1 and k = 4 for a cost of 4 cdot 1 = 4 and select nodes {1, 2, 3, 5} , shuffle their digits and get the desired digits in every node. In sample 2 , we can choose node 1 and k = 2 for a cost of 10000 cdot 2 , select nodes {1, 5} and exchange their digits, and similarly, choose node 2 and k = 2 for a cost of 2000 cdot 2 , select nodes {2, 3} and exchange their digits to get the desired digits in every node. In sample 3 , it is impossible to get the desired digits, because there is no no'...

Tutorials

78202

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
82154928 rainboy E May 31, 2020, 7:05 p.m. OK GNU C11 TESTS 132 171 18432000 2000
82438953 sorrowful_fish E June 4, 2020, 12:09 a.m. OK GNU C++11 TESTS 132 62 8908800 2000
82199823 luogu_bot5 E June 1, 2020, 9:25 a.m. OK GNU C++11 TESTS 132 78 19148800 2000
82260884 luogu_bot3 E June 2, 2020, 12:46 a.m. OK GNU C++11 TESTS 132 78 19148800 2000
82324443 menxin E June 2, 2020, 3:46 p.m. OK GNU C++11 TESTS 132 78 21708800 2000
82200597 Frame233 E June 1, 2020, 9:34 a.m. OK GNU C++11 TESTS 132 93 17612800 2000
82403509 jerrywcy E June 3, 2020, 2:02 p.m. OK GNU C++11 TESTS 132 108 26419200 2000
82233518 npng E June 1, 2020, 3:34 p.m. OK GNU C++11 TESTS 132 109 24780800 2000
82169190 jeffyang E June 1, 2020, 1:37 a.m. OK GNU C++11 TESTS 132 109 27955200 2000
82288854 scimoon E June 2, 2020, 8:56 a.m. OK GNU C++11 TESTS 132 124 17100800 2000
82287887 shengzihang E June 2, 2020, 8:45 a.m. OK GNU C++11 TESTS 132 124 31744000 2000
82316895 spider_0859 E June 2, 2020, 2:23 p.m. OK GNU C++14 TESTS 132 155 53248000 2000
82353880 kkaike E June 3, 2020, 2:19 a.m. OK GNU C++14 TESTS 132 218 17305600 2000
82209449 Kirito E June 1, 2020, 11:15 a.m. OK GNU C++14 TESTS 132 233 22425600 2000
82273546 zxx E June 2, 2020, 5:53 a.m. OK GNU C++14 TESTS 132 233 23244800 2000
82172253 nonameless E June 1, 2020, 3:02 a.m. OK GNU C++14 TESTS 132 234 19251200 2000
82195837 Heristor E June 1, 2020, 8:40 a.m. OK GNU C++14 TESTS 132 249 17612800 2000
82195937 cumtxgg E June 1, 2020, 8:41 a.m. OK GNU C++14 TESTS 132 249 20787200 2000
82224993 LiangMu E June 1, 2020, 2:10 p.m. OK GNU C++14 TESTS 132 249 20787200 2000
82195939 Heristor E June 1, 2020, 8:41 a.m. OK GNU C++14 TESTS 132 264 17612800 2000
82351186 alleviatedRules E June 3, 2020, 12:45 a.m. OK GNU C++14 TESTS 132 280 14336000 2000
82368703 nickluo E June 3, 2020, 6:55 a.m. OK GNU C++17 TESTS 132 155 24678400 2000
82181089 xiaofan7 E June 1, 2020, 5:46 a.m. OK GNU C++17 TESTS 132 156 22732800 2000
82161535 limbo.null E May 31, 2020, 8:58 p.m. OK GNU C++17 TESTS 132 156 22835200 2000
82407886 massimodong E June 3, 2020, 2:48 p.m. OK GNU C++17 TESTS 132 202 17612800 2000
82464977 UTMoonlight E June 4, 2020, 8:51 a.m. OK GNU C++17 TESTS 132 202 25600000 2000
82292032 Maybach E June 2, 2020, 9:35 a.m. OK GNU C++17 TESTS 132 218 20787200 2000
82291975 ac_love_ljm E June 2, 2020, 9:34 a.m. OK GNU C++17 TESTS 132 218 20787200 2000
82167570 bfsdw1qaz E June 1, 2020, 12:35 a.m. OK GNU C++17 TESTS 132 233 21606400 2000
82176936 Huah E June 1, 2020, 4:39 a.m. OK GNU C++17 TESTS 132 234 15974400 2000
82229560 Lipoicyclic E June 1, 2020, 2:54 p.m. OK GNU C++17 TESTS 132 234 19251200 2000
82180293 alif_cse_ju E June 1, 2020, 5:36 a.m. OK GNU C++17 (64) TESTS 132 249 29696000 2000
82270731 besieger E June 2, 2020, 5:09 a.m. OK GNU C++17 (64) TESTS 132 264 32051200 2000
82262619 Canoe E June 2, 2020, 1:48 a.m. OK GNU C++17 (64) TESTS 132 264 32870400 2000
82150557 Priyam2k E May 31, 2020, 6:15 p.m. OK GNU C++17 (64) TESTS 132 265 29696000 2000
82179826 coreproject.yaking E June 1, 2020, 5:29 a.m. OK GNU C++17 (64) TESTS 132 265 32870400 2000
82262512 Bekh E June 2, 2020, 1:45 a.m. OK GNU C++17 (64) TESTS 132 265 32870400 2000
82192202 achvanov E June 1, 2020, 8 a.m. OK GNU C++17 (64) TESTS 132 265 34508800 2000
82150653 sharrad99 E May 31, 2020, 6:15 p.m. OK GNU C++17 (64) TESTS 132 265 36044800 2000
82164232 MZuenni E May 31, 2020, 10:16 p.m. OK GNU C++17 (64) TESTS 132 265 37683200 2000
82203966 ScarletS E June 1, 2020, 10:14 a.m. OK GNU C++17 (64) TESTS 132 265 45670400 2000
82169623 synapse E June 1, 2020, 1:51 a.m. OK Go TESTS 132 156 57036800 2000
82169768 synapse E June 1, 2020, 1:55 a.m. OK Go TESTS 132 171 57241600 2000
82169385 synapse E June 1, 2020, 1:43 a.m. OK Go TESTS 132 576 114688000 2000
82368874 p_unit E June 3, 2020, 6:58 a.m. OK Java 11 TESTS 132 576 96563200 2000
82227298 saikaushik333 E June 1, 2020, 2:33 p.m. OK Java 11 TESTS 132 577 104448000 2000
82222396 anupamm98 E June 1, 2020, 1:43 p.m. OK Java 11 TESTS 132 639 134451200 2000
82328164 Piyush98 E June 2, 2020, 4:28 p.m. OK Java 11 TESTS 132 655 67481600 2000
82178517 anhpp E June 1, 2020, 5:09 a.m. OK Java 11 TESTS 132 701 63590400 2000
82160666 bobib E May 31, 2020, 8:40 p.m. OK Java 11 TESTS 132 701 124211200 2000
82398739 jakejase2 E June 3, 2020, 1:03 p.m. OK Java 11 TESTS 132 732 153497600 2000
82217416 chaparasagar E June 1, 2020, 12:45 p.m. OK Java 11 TESTS 132 826 137523200 2000
82237150 533.sandyhu E June 1, 2020, 4:12 p.m. OK Java 11 TESTS 132 888 107622400 2000
82263172 minaezzat E June 2, 2020, 2:08 a.m. OK Java 11 TESTS 132 889 79667200 2000
82144505 iceburst E May 31, 2020, 5:29 p.m. OK Java 8 TESTS 132 233 9932800 2000
82149861 iceburst E May 31, 2020, 6:07 p.m. OK Java 8 TESTS 132 249 9932800 2000
82211328 te_amo E June 1, 2020, 11:36 a.m. OK Java 8 TESTS 132 436 61849600 2000
82326245 aditya314 E June 2, 2020, 4:06 p.m. OK Java 8 TESTS 132 498 90624000 2000
82152752 tsumit023 E May 31, 2020, 6:38 p.m. OK Java 8 TESTS 132 514 78848000 2000
82341071 prem_cse E June 2, 2020, 7:17 p.m. OK Java 8 TESTS 132 529 67481600 2000
82161510 manish_98 E May 31, 2020, 8:58 p.m. OK Java 8 TESTS 132 561 111923200 2000
82165671 MubtasimShahriar E May 31, 2020, 11:17 p.m. OK Java 8 TESTS 132 639 100454400 2000
82160049 Oopsimbad E May 31, 2020, 8:26 p.m. OK Java 8 TESTS 132 685 98816000 2000
82293163 mei_hu_don E June 2, 2020, 9:50 a.m. OK Java 8 TESTS 132 717 82944000 2000
82198852 Spheniscine E June 1, 2020, 9:14 a.m. OK Kotlin TESTS 132 405 37376000 2000
82425065 AQZZ E June 3, 2020, 6:06 p.m. OK Kotlin TESTS 132 608 123392000 2000
82424894 AQZZ E June 3, 2020, 6:04 p.m. OK Kotlin TESTS 132 670 123392000 2000
82166249 AQZZ E May 31, 2020, 11:45 p.m. OK Kotlin TESTS 132 764 114995200 2000
82158528 Hakiobo E May 31, 2020, 7:58 p.m. OK Kotlin TESTS 132 795 39833600 2000
82166213 AQZZ E May 31, 2020, 11:43 p.m. OK Kotlin TESTS 132 795 115097600 2000
82168109 AQZZ E June 1, 2020, 12:58 a.m. OK Kotlin TESTS 132 873 130252800 2000
82165984 AQZZ E May 31, 2020, 11:31 p.m. OK Kotlin TESTS 132 888 133427200 2000
82167169 AQZZ E June 1, 2020, 12:19 a.m. OK Kotlin TESTS 132 904 111923200 2000
82167877 AQZZ E June 1, 2020, 12:49 a.m. OK Kotlin TESTS 132 936 150630400 2000
82144658 mban259 E May 31, 2020, 5:30 p.m. OK Mono C# TESTS 132 686 122777600 2000
82168315 CLown1331 E June 1, 2020, 1:07 a.m. OK Mono C# TESTS 132 717 158003200 2000
82168341 CLown1331 E June 1, 2020, 1:08 a.m. OK Mono C# TESTS 132 717 158105600 2000
82289271 riantkb E June 2, 2020, 9:02 a.m. OK Mono C# TESTS 132 764 89907200 2000
82168245 CLown1331 E June 1, 2020, 1:04 a.m. OK Mono C# TESTS 132 794 158003200 2000
82178185 P___ E June 1, 2020, 5:03 a.m. OK MS C++ 2017 TESTS 132 327 14643200 2000
82335226 ningBr E June 2, 2020, 5:53 p.m. OK MS C++ 2017 TESTS 132 343 23244800 2000
82253440 The.Cursed.Mage E June 1, 2020, 8:14 p.m. OK MS C++ 2017 TESTS 132 358 25804800 2000
82164693 P___ E May 31, 2020, 10:34 p.m. OK MS C++ 2017 TESTS 132 374 26624000 2000
82164308 youx E May 31, 2020, 10:19 p.m. OK MS C++ 2017 TESTS 132 374 28876800 2000
82155839 PanZverski E May 31, 2020, 7:17 p.m. OK MS C++ 2017 TESTS 132 451 30208000 2000
82291060 akai14 E June 2, 2020, 9:23 a.m. OK MS C++ 2017 TESTS 132 764 16793600 2000
82209848 0Mordecai0 E June 1, 2020, 11:19 a.m. OK MS C++ 2017 TESTS 132 795 15667200 2000
82290669 reikiriyama E June 2, 2020, 9:19 a.m. OK MS C++ 2017 TESTS 132 795 20070400 2000
82290498 akai14 E June 2, 2020, 9:16 a.m. OK MS C++ 2017 TESTS 132 811 20070400 2000
82150776 Darooha E May 31, 2020, 6:17 p.m. OK Ocaml TESTS 132 436 33382400 2000
82319300 yumtam E June 2, 2020, 2:49 p.m. OK PyPy 2 TESTS 132 795 49254400 2000
82165576 realnimish E May 31, 2020, 11:12 p.m. OK PyPy 2 TESTS 132 1075 96256000 2000
82182392 anshuman16423 E June 1, 2020, 6:02 a.m. OK PyPy 2 TESTS 132 1575 48947200 2000
82162636 gintoki_s E May 31, 2020, 9:26 p.m. OK PyPy 3 TESTS 132 811 37990400 2000
82370280 brthyyjp E June 3, 2020, 7:16 a.m. OK PyPy 3 TESTS 132 841 55808000 2000
82171216 tamato E June 1, 2020, 2:36 a.m. OK PyPy 3 TESTS 132 842 40755200 2000
82206916 aberent E June 1, 2020, 10:47 a.m. OK PyPy 3 TESTS 132 873 60928000 2000
82217699 glucose E June 1, 2020, 12:48 p.m. OK PyPy 3 TESTS 132 935 51916800 2000
82256057 FireBird23 E June 1, 2020, 9:19 p.m. OK PyPy 3 TESTS 132 935 98304000 2000
82289658 yumi-yutaku E June 2, 2020, 9:06 a.m. OK PyPy 3 TESTS 132 1044 60108800 2000
82151323 throwawayatcoder E May 31, 2020, 6:23 p.m. OK PyPy 3 TESTS 132 1060 120217600 2000
82268052 ycui11 E June 2, 2020, 4:15 a.m. OK PyPy 3 TESTS 132 1076 33689600 2000
82255788 FireBird23 E June 1, 2020, 9:11 p.m. OK PyPy 3 TESTS 132 1076 95436800 2000
82217480 nwi E June 1, 2020, 12:45 p.m. OK Python 2 TESTS 132 1325 42393600 2000
82144945 1194code E May 31, 2020, 5:31 p.m. OK Python 3 TESTS 132 1512 31436800 2000
82146432 1194code E May 31, 2020, 5:40 p.m. OK Python 3 TESTS 132 1637 31539200 2000
82179440 nebocco E June 1, 2020, 5:24 a.m. OK Python 3 TESTS 132 1669 39833600 2000
82294553 mkawa2 E June 2, 2020, 10:08 a.m. OK Python 3 TESTS 132 1700 51302400 2000
82215100 alon276 E June 1, 2020, 12:18 p.m. OK Python 3 TESTS 132 1949 51097600 2000
82165464 alon276 E May 31, 2020, 11:06 p.m. OK Python 3 TESTS 132 1980 137216000 2000
82145563 potpath E May 31, 2020, 5:34 p.m. OK Python 3 TESTS 132 1996 32972800 2000
82311330 pandrei E June 2, 2020, 1:21 p.m. OK Rust TESTS 132 389 30412800 2000
82349376 kobae964 E June 2, 2020, 11:25 p.m. OK Rust TESTS 132 483 37888000 2000
82225715 gazaan E June 1, 2020, 2:17 p.m. OK Scala TESTS 132 1419 34508800 2000

remove filters

Back to search problems