EPIC Institute of Technology Round Summer 2024 (Div. 1 + 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
1987 EPIC Institute of Technology Round Summer 2024 (Div. 1 + Div. 2) FINISHED False 10800 17421863 June 30, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3504 ) E Wonderful Tree! PROGRAMMING brute force dfs and similar dp flows greedy trees

B"You are given a tree with n vertices, rooted at vertex 1 . The i -th vertex has an integer a_i written on it. Let L be the set of all direct children ^{ text{ xe2 x88 x97}} of v . A tree is called wonderful, if for all vertices v where L is not empty, a_v <= sum_{u in L}{a_u}. In one operation, you choose any vertex v and increase a_v by 1 . Find the minimum number of operations needed to make the given tree wonderful! ^{ text{ xe2 x88 x97}} Vertex u is called a direct child of vertex v if: Each test contains multiple test cases. The first line of input contains a single integer t ( 1 <= t <= 1000 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 2 <= n <= 5000 ) -- the number of vertices in the tree. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 0 <= a_i <= 10^9 ) -- the values initially written on the vertices. The third line of each test case contains n - 1 integers p_2, p_3 , ldots, p_n ( 1 <= p_i < i ), indicating that there is an edge from vertex p_i to vertex i . It is guaranteed that the given edges form a tree. It is guaranteed that the sum of n over all test cases does not exceed 5000 . For each test case, output a single integer -- the minimum number of operations needed to make the tree wonderful. The tree in the first test case: You can apply the operation once on vertex 5 and twice on vertex 2 to get a wonderful tree. In the second test case, you can apply the operation twice on vertex 2 to get a wonderful tree. In the third and fourth test cases, the tree is already wonderful, so you don't need to apply any operations. "...

Tutorials

EPIC Institute of Technology Round Summer 2024 (Div. 1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
268212654 aqwalnut E June 30, 2024, 5:12 p.m. OK C# 10 TESTS 39 343 174284800
268261754 shrimpballs E July 1, 2024, 4:31 a.m. OK C++14 (GCC 6-32) TESTS 43 46 307200
268228035 TrendBattles E June 30, 2024, 7:03 p.m. OK C++14 (GCC 6-32) TESTS 41 77 0
268219640 nooooob_KiFaH_HeLaL E June 30, 2024, 5:32 p.m. OK C++14 (GCC 6-32) TESTS 39 77 0
268260976 2jczoo8 E July 1, 2024, 4:22 a.m. OK C++14 (GCC 6-32) TESTS 43 77 307200
268212143 tuihuademing5 E June 30, 2024, 5:10 p.m. OK C++14 (GCC 6-32) TESTS 39 77 307200
268214525 liangxingdeng E June 30, 2024, 5:18 p.m. OK C++14 (GCC 6-32) TESTS 39 109 4096000
268224808 Umiyuri E June 30, 2024, 6:34 p.m. OK C++14 (GCC 6-32) TESTS 39 124 204800
268250723 _doctorZ E July 1, 2024, 1:57 a.m. OK C++14 (GCC 6-32) TESTS 42 125 307200
268210645 cbdsopa E June 30, 2024, 5:05 p.m. OK C++14 (GCC 6-32) TESTS 39 140 307200
268249633 hqmm E July 1, 2024, 1:36 a.m. OK C++14 (GCC 6-32) TESTS 41 140 14028800
268258592 yzkkai E July 1, 2024, 3:53 a.m. OK C++17 (GCC 7-32) TESTS 43 46 0
268244762 S4muraj E June 30, 2024, 11:48 p.m. OK C++17 (GCC 7-32) TESTS 41 62 307200
268213566 _RED__ E June 30, 2024, 5:15 p.m. OK C++17 (GCC 7-32) TESTS 39 77 0
268211498 eklavya_k E June 30, 2024, 5:08 p.m. OK C++17 (GCC 7-32) TESTS 39 77 0
268208243 Imagine.2019 E June 30, 2024, 4:58 p.m. OK C++17 (GCC 7-32) TESTS 39 77 0
268232418 _gzj E June 30, 2024, 7:56 p.m. OK C++17 (GCC 7-32) TESTS 41 77 307200
268231934 Wizard_of_Orz E June 30, 2024, 7:50 p.m. OK C++17 (GCC 7-32) TESTS 41 77 307200
268228340 Turbo_Fast_Submit E June 30, 2024, 7:07 p.m. OK C++17 (GCC 7-32) TESTS 41 77 307200
268213621 mrmoooo E June 30, 2024, 5:15 p.m. OK C++17 (GCC 7-32) TESTS 39 77 307200
268218763 Sahil_32 E June 30, 2024, 5:30 p.m. OK C++17 (GCC 7-32) TESTS 39 77 26112000
268252946 Retired_Isaunoya E July 1, 2024, 2:35 a.m. OK C++20 (GCC 13-64) TESTS 43 46 0
268251525 iscunoya E July 1, 2024, 2:11 a.m. OK C++20 (GCC 13-64) TESTS 43 46 0
268264965 fishcathu. E July 1, 2024, 5:11 a.m. OK C++20 (GCC 13-64) TESTS 43 61 204800
268245384 houzhiyuan123 E July 1, 2024, 12:03 a.m. OK C++20 (GCC 13-64) TESTS 41 62 0
268257167 nuc_lx E July 1, 2024, 3:35 a.m. OK C++20 (GCC 13-64) TESTS 43 62 102400
268269860 do_while_true E July 1, 2024, 6:01 a.m. OK C++20 (GCC 13-64) TESTS 43 62 307200
268253487 Aria_Math E July 1, 2024, 2:43 a.m. OK C++20 (GCC 13-64) TESTS 43 62 307200
268252451 Sin_Watt E July 1, 2024, 2:27 a.m. OK C++20 (GCC 13-64) TESTS 43 62 409600
268237981 lunchbox E June 30, 2024, 9:16 p.m. OK C++20 (GCC 13-64) TESTS 41 62 409600
268225452 monna4335 E June 30, 2024, 6:37 p.m. OK C++20 (GCC 13-64) TESTS 39 62 409600
268209643 Gassa E June 30, 2024, 5:02 p.m. OK D TESTS 39 702 3276800
268240989 rainboy E June 30, 2024, 10:15 p.m. OK GNU C11 TESTS 41 62 1024000
268214896 ArminArlert69 E June 30, 2024, 5:19 p.m. OK GNU C11 TESTS 39 390 202547200
268214101 himanshu-0104 E June 30, 2024, 5:16 p.m. OK Go TESTS 39 249 202547200
268212077 FierteDeCeylan E June 30, 2024, 5:10 p.m. OK Java 21 TESTS 39 686 262144000
268217532 HiddenBliz E June 30, 2024, 5:27 p.m. OK Java 21 TESTS 39 749 256716800
268241998 dzhi E June 30, 2024, 10:38 p.m. OK Java 21 TESTS 41 983 108748800
268218617 man-ray E June 30, 2024, 5:30 p.m. OK Java 21 TESTS 39 1515 1228800
268217212 RockingMat E June 30, 2024, 5:26 p.m. OK Java 21 TESTS 39 1686 1126400
268228979 Yousef_Badr E June 30, 2024, 7:15 p.m. OK Java 8 TESTS 41 905 0
268234276 Yousef_Badr E June 30, 2024, 8:19 p.m. OK Java 8 TESTS 41 921 0
268229161 Yousef_Badr E June 30, 2024, 7:17 p.m. OK Java 8 TESTS 41 921 0
268228912 Yousef_Badr E June 30, 2024, 7:14 p.m. OK Java 8 TESTS 41 952 0
268216528 ashupadey1620 E June 30, 2024, 5:24 p.m. OK Java 8 TESTS 39 1671 263065600
268217683 nsk_99 E June 30, 2024, 5:27 p.m. OK Java 8 TESTS 39 1812 263270400
268216350 cpaliwal2483 E June 30, 2024, 5:23 p.m. OK Java 8 TESTS 39 1859 263270400
268218908 tomarshashank9 E June 30, 2024, 5:30 p.m. OK Kotlin 1.7 TESTS 39 1890 268390400
268209820 bronze_coder E June 30, 2024, 5:03 p.m. OK PyPy 3-64 TESTS 39 233 6348800
268211556 hxu10 E June 30, 2024, 5:08 p.m. OK PyPy 3-64 TESTS 39 374 108953600
268251626 mikeac E July 1, 2024, 2:13 a.m. OK PyPy 3-64 TESTS 43 375 204185600
268212431 josewxy E June 30, 2024, 5:11 p.m. OK PyPy 3-64 TESTS 39 375 204185600
268268127 mikeac E July 1, 2024, 5:45 a.m. OK PyPy 3-64 TESTS 43 436 4812800
268224787 helli5.tech E June 30, 2024, 6:34 p.m. OK PyPy 3-64 TESTS 39 437 10137600
268208368 tassei903 E June 30, 2024, 4:58 p.m. OK PyPy 3-64 TESTS 39 468 125235200
268267990 mikeac E July 1, 2024, 5:44 a.m. OK PyPy 3-64 TESTS 43 514 9216000
268220263 cottoncotton E June 30, 2024, 5:33 p.m. OK Rust 2021 TESTS 39 124 1024000
268232079 kz2d E June 30, 2024, 7:52 p.m. OK Rust 2021 TESTS 41 249 173772800

remove filters

Back to search problems