Codeforces Round 862 (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
1805 Codeforces Round 862 (Div. 2) FINISHED False 7200 51377099 April 2, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1648 ) E There Should Be a Lot of Maximums PROGRAMMING data structures dfs and similar ds graphs trees

B"You are given a tree (a connected graph without cycles). Each vertex of the tree contains an integer. Let's define the mathrm{MAD} (maximum double) parameter of the tree as the maximum integer that occurs in the vertices of the tree at least 2 times. If no number occurs in the tree more than once, then we assume mathrm{MAD}=0 . Note that if you remove an edge from the tree, it splits into two trees. Let's compute the mathrm{MAD} parameters of the two trees and take the maximum of the two values. Let the result be the value of the deleted edge. For each edge, find its value. Note that we don't actually delete any edges from the tree, the values are to be found independently. The first line contains one integer n ( 2 <= n <= 10^5 ) -- the number of vertices in the tree. Each of the next n - 1 lines contains two integers u and v ( 1 <= u, v <= n ) -- the ends of an edge of the tree. It's guaranteed that the given edges form a valid tree. The last line contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= 10^9 ) -- the numbers in the vertices. For each edge in the input order, print one number -- the maximum of the mathrm{MAD} parameters of the two trees obtained after removing the given edge from the initial tree. In the first example, after removing edge (1, 2) no number repeats 2 times in any of the resulting subtrees, so the answer is max(0, 0)=0 . After removing edge (2, 3) , in the bigger subtree, 1 is repeated twice, and 2 is repeated twice, so the mathrm{MAD} of this tree is 2 . After removing edge (2, 4) , in the bigger subtree, only the number 1 is repeated, and in the second subtree, only one number appears, so the answer is 1 . In the second example, if edge 1 <= ftrightarrow 4 is not removed, then one of the subtrees will have two 1 , so the answer -- 1 . And if edge 1 "...

Tutorials

Editorial of Codeforces Round #862 (Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
200472006 rainboy E April 2, 2023, 7:18 p.m. OK GNU C11 TESTS 51 514 11468800
200503688 Yuki991 E April 3, 2023, 4:44 a.m. OK GNU C++14 TESTS 54 249 18636800
200504518 sybsyb E April 3, 2023, 4:56 a.m. OK GNU C++14 TESTS 54 311 65024000
200457796 shenyibin E April 2, 2023, 5:24 p.m. OK GNU C++14 TESTS 51 327 65024000
200492495 hackerbhaiya E April 3, 2023, 12:50 a.m. OK GNU C++14 TESTS 53 342 32563200
200450189 2020gangbazi E April 2, 2023, 4:28 p.m. OK GNU C++14 TESTS 51 390 28364800
200456845 Uagu E April 2, 2023, 5:21 p.m. OK GNU C++14 TESTS 51 405 13516800
200466468 wuhudsm E April 2, 2023, 6:24 p.m. OK GNU C++14 TESTS 51 452 76390400
200450658 doveking E April 2, 2023, 4:29 p.m. OK GNU C++14 TESTS 51 607 18739200
200468564 Seast E April 2, 2023, 6:43 p.m. OK GNU C++14 TESTS 51 623 22630400
200489548 aajay7546888562 E April 2, 2023, 11:33 p.m. OK GNU C++14 TESTS 53 655 20992000
200496921 hibye1217 E April 3, 2023, 2:39 a.m. OK GNU C++17 TESTS 53 155 20992000
200456391 woruo27 E April 2, 2023, 5:20 p.m. OK GNU C++17 TESTS 51 217 15462400
200479395 lotusblume E April 2, 2023, 8:45 p.m. OK GNU C++17 TESTS 51 218 20070400
200463811 TsunamiNoLetGo E April 2, 2023, 6:02 p.m. OK GNU C++17 TESTS 51 218 25497600
200459889 plast E April 2, 2023, 5:35 p.m. OK GNU C++17 TESTS 51 233 27648000
200499609 psc233 E April 3, 2023, 3:34 a.m. OK GNU C++17 TESTS 53 234 17817600
200453481 DylanSmith E April 2, 2023, 4:34 p.m. OK GNU C++17 TESTS 51 248 16384000
200502205 Hritik12 E April 3, 2023, 4:21 a.m. OK GNU C++17 TESTS 53 248 22425600
200451054 shdut0901 E April 2, 2023, 4:30 p.m. OK GNU C++17 TESTS 51 249 21401600
200457405 _Kkura_ E April 2, 2023, 5:23 p.m. OK GNU C++17 TESTS 51 249 29593600
200502279 HCCH E April 3, 2023, 4:22 a.m. OK GNU C++17 (64) TESTS 53 186 26009600
200459245 Lucina E April 2, 2023, 5:31 p.m. OK GNU C++17 (64) TESTS 51 187 25600000
200458923 Lucina E April 2, 2023, 5:30 p.m. OK GNU C++17 (64) TESTS 51 202 37580800
200501903 lldar E April 3, 2023, 4:15 a.m. OK GNU C++17 (64) TESTS 53 218 31948800
200470239 lgkm39 E April 2, 2023, 7 p.m. OK GNU C++17 (64) TESTS 51 233 22118400
200481952 anhkha2003 E April 2, 2023, 9:16 p.m. OK GNU C++17 (64) TESTS 52 233 26521600
200500614 GILGAMESH E April 3, 2023, 3:52 a.m. OK GNU C++17 (64) TESTS 53 249 43520000
200466935 wakaranai E April 2, 2023, 6:27 p.m. OK GNU C++17 (64) TESTS 51 265 15974400
200466141 wakaranai E April 2, 2023, 6:21 p.m. OK GNU C++17 (64) TESTS 51 280 21196800
200466395 wakaranai E April 2, 2023, 6:23 p.m. OK GNU C++17 (64) TESTS 51 280 21196800
200491269 SirRembocodina E April 3, 2023, 12:18 a.m. OK GNU C++20 (64) TESTS 53 140 33075200
200457317 AkaiLemon E April 2, 2023, 5:22 p.m. OK GNU C++20 (64) TESTS 51 156 23244800
200495688 coconut99 E April 3, 2023, 2:12 a.m. OK GNU C++20 (64) TESTS 53 156 24678400
200458206 SirRembocodina E April 2, 2023, 5:26 p.m. OK GNU C++20 (64) TESTS 51 156 33792000
200471025 Penguin07 E April 2, 2023, 7:08 p.m. OK GNU C++20 (64) TESTS 51 171 28774400
200459406 Lucina E April 2, 2023, 5:32 p.m. OK GNU C++20 (64) TESTS 51 187 25600000
200500722 NeroZein E April 3, 2023, 3:54 a.m. OK GNU C++20 (64) TESTS 53 187 28774400
200487447 Thallium54 E April 2, 2023, 10:46 p.m. OK GNU C++20 (64) TESTS 53 202 24473600
200456689 yingluosanqian E April 2, 2023, 5:21 p.m. OK GNU C++20 (64) TESTS 51 202 25702400
200458102 Dan13llljws E April 2, 2023, 5:26 p.m. OK GNU C++20 (64) TESTS 51 202 30412800
200493211 dzhi E April 3, 2023, 1:09 a.m. OK Java 11 TESTS 53 733 45670400
200493739 dzhi E April 3, 2023, 1:23 a.m. OK Java 11 TESTS 53 748 45465600
200492752 dzhi E April 3, 2023, 12:57 a.m. OK Java 11 TESTS 53 794 45670400
200493250 dzhi E April 3, 2023, 1:10 a.m. OK Java 11 TESTS 53 795 45568000
200487663 profchi E April 2, 2023, 10:50 p.m. OK Java 11 TESTS 53 810 109363200
200451040 Dukkha E April 2, 2023, 4:30 p.m. OK Java 17 TESTS 51 889 67481600
200503046 Socrates1232 E April 3, 2023, 4:34 a.m. OK Java 17 TESTS 54 951 88576000
200482227 SecondThread E April 2, 2023, 9:20 p.m. OK Java 8 TESTS 52 530 79052800
200480676 golions E April 2, 2023, 8:59 p.m. OK Java 8 TESTS 51 748 79462400
200488370 hxu10 E April 2, 2023, 11:07 p.m. OK PyPy 3 TESTS 53 685 53657600
200459320 huikang E April 2, 2023, 5:32 p.m. OK PyPy 3-64 TESTS 51 935 106496000
200452503 robostac E April 2, 2023, 4:33 p.m. OK Rust 2021 TESTS 51 312 66867200

remove filters

Back to search problems