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 |
---|---|---|---|---|---|---|
1910 | Kotlin Heroes: Episode 9 (Unrated, T-Shirts + Prizes!) | FINISHED | False | 9000 | 29517899 | Dec. 11, 2023, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 48 ) | J | Two Colors | PROGRAMMING | *special |
B"You are given a tree consisting of n vertices. Some vertices of the tree are red, all other vertices are blue. Each edge of the tree has a positive weight. Let's define d(x, y) as the distance between the vertices x and y , i. xe2 x80 x89e. the sum of weights of edges belonging to the simple path between x and y . For each vertex, you have to choose an integer v_i . These integers should meet the following constraint: for every blue vertex b and every red vertex r , d(b, r) ge v_b + v_r . You have to maximize the value of sum limits_{i=1}^{n} v_i . Note that the values of v_i are not necessarily positive. The first line contains one integer n ( 2 <= n <= 3 cdot 10^5 ). The second line contains n integers c_1, c_2, ... , c_n ( 0 <= c_i <= 1 ). If the i -th vertex is red, c_i = 1 , otherwise c_i = 0 . Then n-1 lines follow. Each line contains three integers x_i , y_i and w_i ( 1 <= x_i, y_i <= n ; 1 <= w_i <= 10^6 ; x_i ne y_i ) denoting an edge between the vertices x_i and y_i which has weight w_i . These edges form a tree. If the value of sum limits_{i=1}^{n} v_i can be as big as possible, print Infinity. Otherwise, print one integer -- the maximum possible value of sum limits_{i=1}^{n} v_i you can get. In the first example, you can assign v_1 = 120, v_2 = 20, v_3 = 80, v_4 = 130 . "... |
123261 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
236805622 | arvindf232 | J | Dec. 11, 2023, 4:04 p.m. | OK | Kotlin 1.7 | TESTS | 69 | 514 | 47206400 | ||
236808837 | Golovanov399 | J | Dec. 11, 2023, 4:27 p.m. | OK | Kotlin 1.7 | TESTS | 69 | 2276 | 321126400 | ||
236809681 | Potassium | J | Dec. 11, 2023, 4:34 p.m. | OK | Kotlin 1.7 | TESTS | 69 | 2495 | 377344000 | ||
236802493 | HungaryIOITeam | J | Dec. 11, 2023, 3:42 p.m. | OK | Kotlin 1.7 | TESTS | 69 | 2714 | 405504000 | ||
236836297 | chappy1 | J | Dec. 11, 2023, 9:31 p.m. | OK | Kotlin 1.7 | TESTS | 69 | 2744 | 407756800 | ||
236843875 | cmk666 | J | Dec. 12, 2023, 1:12 a.m. | OK | Kotlin 1.7 | TESTS | 69 | 3135 | 354099200 | ||
236851356 | Benq | J | Dec. 12, 2023, 4:10 a.m. | OK | Kotlin 1.9 | TESTS | 69 | 2090 | 355430400 | ||
236798703 | tourist | J | Dec. 11, 2023, 3:18 p.m. | OK | Kotlin 1.9 | TESTS | 69 | 2198 | 357683200 | ||
236812405 | errorgorn | J | Dec. 11, 2023, 4:56 p.m. | OK | Kotlin 1.9 | TESTS | 69 | 2230 | 301465600 | ||
236806419 | Heltion | J | Dec. 11, 2023, 4:09 p.m. | OK | Kotlin 1.9 | TESTS | 69 | 2324 | 346316800 | ||
236805355 | Tlatoani | J | Dec. 11, 2023, 4:02 p.m. | OK | Kotlin 1.9 | TESTS | 69 | 2620 | 403046400 |
Back to search problems