Codeforces Round 864 (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
1797 Codeforces Round 864 (Div. 2) FINISHED False 7200 59241290 April 8, 2023, 2:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 4150 ) D Li Hua and Tree PROGRAMMING brute force data structures dfs and similar dp implementation trees

B'Li Hua has a tree of n vertices and n-1 edges. The root of the tree is vertex 1 . Each vertex i has importance a_i . Denote the size of a subtree as the number of vertices in it, and the importance as the sum of the importance of vertices in it. Denote the heavy son of a non-leaf vertex as the son with the largest subtree size. If multiple of them exist, the heavy son is the one with the minimum index. Li Hua wants to perform m operations: Suppose you were Li Hua, please solve this problem. The first line contains 2 integers n,m ( 2 <= n <= 10^{5},1 <= m <= 10^{5} ) -- the number of vertices in the tree and the number of operations. The second line contains n integers a_{1},a_{2}, ldots ,a_{n} ( -10^{9} <= a_{i} <= 10^{9} ) -- the importance of each vertex. Next n-1 lines contain the edges of the tree. The i -th line contains two integers u_i and v_i ( 1 <= u_i,v_i <= n , u_i ne v_i ) -- the corresponding edge. The given edges form a tree. Next m lines contain operations -- one operation per line. The j -th operation contains two integers t_{j},x_{j} ( t_{j} in {1,2 } , 1 <= q x_{j} <= q n , x_{j} neq 1 if t_j = 2 ) -- the j -th operation. For each query "1 x ", output the answer in an independent line. In the first example: The initial tree is shown in the following picture: The importance of the subtree of 6 is a_6+a_7=2 . After rotating the heavy son of 3 (which is 6 ) up, the tree is shown in the following picture: The importance of the subtree of 6 is a_6+a_3+a_7=3 . The importance of the subtree of 2 is a_2+a_4+a_5=3 . '...

Tutorials

Codeforces Round 864 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
201356447 DmitriyAnikeyev D April 8, 2023, 5:07 p.m. OK C# 10 TESTS 46 701 80588800
201397859 Shui_Dream D April 8, 2023, 11:39 p.m. OK GNU C++14 TESTS 46 171 17817600
201409221 Lstg D April 9, 2023, 3:06 a.m. OK GNU C++14 TESTS 46 171 19353600
201423057 Foreverftip D April 9, 2023, 6 a.m. OK GNU C++14 TESTS 46 171 27852800
201410084 Lstg D April 9, 2023, 3:19 a.m. OK GNU C++14 TESTS 46 186 20275200
201410296 Lstg D April 9, 2023, 3:24 a.m. OK GNU C++14 TESTS 46 186 22118400
201399307 colOr_by_colOr D April 9, 2023, 12:10 a.m. OK GNU C++14 TESTS 46 187 15667200
201407474 Je3ter D April 9, 2023, 2:39 a.m. OK GNU C++14 TESTS 46 187 15872000
201403388 zhendelan D April 9, 2023, 1:32 a.m. OK GNU C++14 TESTS 46 187 18227200
201352341 jrsy D April 8, 2023, 4:47 p.m. OK GNU C++14 TESTS 46 187 18944000
201413580 Nahida__ D April 9, 2023, 4:11 a.m. OK GNU C++14 TESTS 46 187 19353600
201422016 MarbIue D April 9, 2023, 5:50 a.m. OK GNU C++17 TESTS 46 124 18022400
201411569 cppiddy D April 9, 2023, 3:42 a.m. OK GNU C++17 TESTS 46 139 12492800
201373265 TimDSF D April 8, 2023, 7:10 p.m. OK GNU C++17 TESTS 46 186 21811200
201413433 farmerboy D April 9, 2023, 4:09 a.m. OK GNU C++17 TESTS 46 187 15462400
201416315 XDEv11 D April 9, 2023, 4:50 a.m. OK GNU C++17 TESTS 46 187 18227200
201409663 N.E.R.O D April 9, 2023, 3:13 a.m. OK GNU C++17 TESTS 46 187 18227200
201415938 harman_69 D April 9, 2023, 4:45 a.m. OK GNU C++17 TESTS 46 187 18636800
201414051 Anuj123321 D April 9, 2023, 4:18 a.m. OK GNU C++17 TESTS 46 187 18636800
201396284 Kumiko_senpai D April 8, 2023, 11:07 p.m. OK GNU C++17 TESTS 46 187 20172800
201366282 Jerry20110434 D April 8, 2023, 6:13 p.m. OK GNU C++17 TESTS 46 187 20582400
201371824 y_combinator D April 8, 2023, 6:59 p.m. OK GNU C++17 (64) TESTS 46 170 28160000
201379927 enslaved D April 8, 2023, 8:03 p.m. OK GNU C++17 (64) TESTS 46 171 28774400
201373987 danielvitor23 D April 8, 2023, 7:15 p.m. OK GNU C++17 (64) TESTS 46 171 34508800
201415102 yamate11 D April 9, 2023, 4:33 a.m. OK GNU C++17 (64) TESTS 46 171 39321600
201355999 gabmei D April 8, 2023, 5:05 p.m. OK GNU C++17 (64) TESTS 46 186 33792000
201355199 ChroneZU D April 8, 2023, 5 p.m. OK GNU C++17 (64) TESTS 46 186 34611200
201359005 Giga_Cronos D April 8, 2023, 5:23 p.m. OK GNU C++17 (64) TESTS 46 186 35635200
201355790 illume2021 D April 8, 2023, 5:04 p.m. OK GNU C++17 (64) TESTS 46 186 35737600
201357049 FplusFplusF D April 8, 2023, 5:11 p.m. OK GNU C++17 (64) TESTS 46 186 40448000
201366187 tezk D April 8, 2023, 6:13 p.m. OK GNU C++17 (64) TESTS 46 187 33382400
201361210 CLT D April 8, 2023, 5:37 p.m. OK GNU C++20 (64) TESTS 46 93 31744000
201354427 ReiAC D April 8, 2023, 4:57 p.m. OK GNU C++20 (64) TESTS 46 124 34918400
201371328 arbalestOvO D April 8, 2023, 6:55 p.m. OK GNU C++20 (64) TESTS 46 124 42700800
201364573 magnus.hegdahl D April 8, 2023, 6 p.m. OK GNU C++20 (64) TESTS 46 140 22937600
201384756 Jbuhbburavipatiharsh D April 8, 2023, 8:43 p.m. OK GNU C++20 (64) TESTS 46 140 29286400
201415911 harman_69 D April 9, 2023, 4:45 a.m. OK GNU C++20 (64) TESTS 46 140 31744000
201370580 Miyano_Shiho D April 8, 2023, 6:49 p.m. OK GNU C++20 (64) TESTS 46 140 31846400
201354213 ReiAC D April 8, 2023, 4:55 p.m. OK GNU C++20 (64) TESTS 46 140 31948800
201396061 RHEXAOC D April 8, 2023, 11:03 p.m. OK GNU C++20 (64) TESTS 46 155 24166400
201403568 eggag32 D April 9, 2023, 1:35 a.m. OK GNU C++20 (64) TESTS 46 155 27750400
201362100 dzhi D April 8, 2023, 5:43 p.m. OK Java 11 TESTS 46 654 45363200
201362376 dzhi D April 8, 2023, 5:45 p.m. OK Java 11 TESTS 46 686 45363200
201395410 codingIsFun1234 D April 8, 2023, 10:51 p.m. OK Java 11 TESTS 46 826 80896000
201355825 TCchen D April 8, 2023, 5:04 p.m. OK Java 17 TESTS 46 624 52531200
201363231 this.is.shivamsingh D April 8, 2023, 5:51 p.m. OK Java 17 TESTS 46 841 74956800
201352607 Aaryendra D April 8, 2023, 4:48 p.m. OK Java 17 TESTS 46 998 119808000
201372653 Yuh_03 D April 8, 2023, 7:06 p.m. OK Java 17 TESTS 46 1076 93696000
201362435 nomadicjuggrnaut D April 8, 2023, 5:45 p.m. OK Java 8 TESTS 46 623 43212800
201403184 FlameFire D April 9, 2023, 1:29 a.m. OK Java 8 TESTS 46 904 44646400
201402818 FlameFire D April 9, 2023, 1:22 a.m. OK Java 8 TESTS 46 998 44646400
201355947 hxu10 D April 8, 2023, 5:05 p.m. OK PyPy 3 TESTS 46 1029 41472000
201356076 hxu10 D April 8, 2023, 5:05 p.m. OK PyPy 3-64 TESTS 46 841 66867200
201382203 secondhalf D April 8, 2023, 8:22 p.m. OK PyPy 3-64 TESTS 46 873 56832000
201392864 secondhalf D April 8, 2023, 10:09 p.m. OK PyPy 3-64 TESTS 46 904 54169600
201354988 old_boo D April 8, 2023, 4:59 p.m. OK PyPy 3-64 TESTS 46 997 59596800
201358631 Maruzensky D April 8, 2023, 5:21 p.m. OK PyPy 3-64 TESTS 46 1013 62873600
201354373 Peacalm D April 8, 2023, 4:56 p.m. OK PyPy 3-64 TESTS 46 1060 75366400
201357142 Peacalm D April 8, 2023, 5:11 p.m. OK PyPy 3-64 TESTS 46 1091 84172800
201419079 pythonist_viking D April 9, 2023, 5:21 a.m. OK PyPy 3-64 TESTS 46 1091 117862400
201356590 Peacalm D April 8, 2023, 5:08 p.m. OK PyPy 3-64 TESTS 46 1092 81510400
201401073 pythonist_viking D April 9, 2023, 12:48 a.m. OK PyPy 3-64 TESTS 46 1092 133427200
201416129 Komali0214 D April 9, 2023, 4:48 a.m. OK Python 3 TESTS 46 1247 40140800
201355237 Peacalm D April 8, 2023, 5:01 p.m. OK Python 3 TESTS 46 1356 40140800
201393727 liut D April 8, 2023, 10:22 p.m. OK Rust 2021 TESTS 46 139 49868800

remove filters

Back to search problems