COMPFEST 13 - Finals Online Mirror (Unrated, ICPC Rules, Teams Preferred)

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
1575 COMPFEST 13 - Finals Online Mirror (Unrated, ICPC Rules, Teams Preferred) FINISHED False 18000 98641499 Oct. 2, 2021, 1:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 336 ) E Eye-Pleasing City Park Tour PROGRAMMING

B'There is a city park represented as a tree with n attractions as its vertices and n - 1 rails as its edges. The i -th attraction has happiness value a_i . Each rail has a color. It is either black if t_i = 0 , or white if t_i = 1 . Black trains only operate on a black rail track, and white trains only operate on a white rail track. If you are previously on a black train and want to ride a white train, or you are previously on a white train and want to ride a black train, you need to use 1 ticket. The path of a tour must be a simple path -- it must not visit an attraction more than once. You do not need a ticket the first time you board a train. You only have k tickets, meaning you can only switch train types at most k times. In particular, you do not need a ticket to go through a path consisting of one rail color. Define f(u, v) as the sum of happiness values of the attractions in the tour (u, v) , which is a simple path that starts at the u -th attraction and ends at the v -th attraction. Find the sum of f(u,v) for all valid tours (u, v) ( 1 <= q u <= q v <= q n ) that does not need more than k tickets, modulo 10^9 + 7 . The first line contains two integers n and k ( 2 <= q n <= q 2 cdot 10^5 , 0 <= q k <= q n-1 ) -- the number of attractions in the city park and the number of tickets you have. The second line contains n integers a_1, a_2, ldots, a_n ( 0 <= q a_i <= q 10^9 ) -- the happiness value of each attraction. The i -th of the next n - 1 lines contains three integers u_i , v_i , and t_i ( 1 <= q u_i, v_i <= q n , 0 <= q t_i <= q 1 ) -- an edge between vertices u_i and v_i with color t_i . The given edges form a tree. Output an integer denoting the total happiness value for all valid tours (u, v) ( 1 <= q u <= q v <= q n ), modulo 10^9 + 7 . '...

Tutorials

COMPFEST 13 — Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
130589311 Melania ttee E Oct. 2, 2021, 5:56 p.m. OK GNU C++14 TESTS 26 1153 57036800
130585451 maojiayi wangziji AcFunction E Oct. 2, 2021, 5:03 p.m. OK GNU C++14 TESTS 26 1887 26828800
130592361 nandonathaniel E Oct. 2, 2021, 6:37 p.m. OK GNU C++14 TESTS 26 2417 48844800
130594928 Bugman E Oct. 2, 2021, 7:23 p.m. OK GNU C++17 TESTS 26 1044 38195200
130589593 Bugman E Oct. 2, 2021, 6 p.m. OK GNU C++17 TESTS 26 1076 41574400
130579395 old_player E Oct. 2, 2021, 3:47 p.m. OK GNU C++17 TESTS 26 1184 27136000
130590981 gisp_zjz E Oct. 2, 2021, 6:18 p.m. OK GNU C++17 TESTS 26 1762 26726400
130584967 khuebeo ngfam_kongu chemthan E Oct. 2, 2021, 4:56 p.m. OK GNU C++17 TESTS 26 1762 33587200
130592906 wiwitrifai E Oct. 2, 2021, 6:47 p.m. OK GNU C++17 TESTS 26 1887 35020800
130590497 aarr afterall Amoo_Safar E Oct. 2, 2021, 6:12 p.m. OK GNU C++17 TESTS 26 2105 53248000
130572447 Retired_MiFaFaOvO TLE Miracle03 E Oct. 2, 2021, 2:34 p.m. OK GNU C++17 TESTS 26 2120 64307200
130584677 chenjb shb123 FrostStar E Oct. 2, 2021, 4:53 p.m. OK GNU C++17 TESTS 26 2807 177766400
130590895 arjo aditya.verma amul_agrawal E Oct. 2, 2021, 6:17 p.m. OK GNU C++17 TESTS 26 3244 191590400
130582243 xay5421 E Oct. 2, 2021, 4:21 p.m. OK GNU C++17 (64) TESTS 26 811 51404800
130588155 RedstoneGamer22 Autron AlexLuchianov E Oct. 2, 2021, 5:39 p.m. OK GNU C++17 (64) TESTS 26 888 53043200
130592047 SSerxhs fr200110217102 E Oct. 2, 2021, 6:33 p.m. OK GNU C++17 (64) TESTS 26 997 54476800
130590457 tute7627 noimi E Oct. 2, 2021, 6:11 p.m. OK GNU C++17 (64) TESTS 26 1045 43315200
130593221 Rubikun E Oct. 2, 2021, 6:52 p.m. OK GNU C++17 (64) TESTS 26 1076 44851200
130587844 risujiroh E Oct. 2, 2021, 5:35 p.m. OK GNU C++17 (64) TESTS 26 1092 37376000
130590318 riantkb nuip mtsd E Oct. 2, 2021, 6:09 p.m. OK GNU C++17 (64) TESTS 26 1169 71577600
130598354 Rubikun E Oct. 2, 2021, 8:33 p.m. OK GNU C++17 (64) TESTS 26 1247 49254400
130583301 heno239 E Oct. 2, 2021, 4:34 p.m. OK GNU C++17 (64) TESTS 26 1356 66355200
130587564 DreamingLeaf JooDdae edenooo E Oct. 2, 2021, 5:31 p.m. OK GNU C++17 (64) TESTS 26 1434 47513600
130587889 sansen E Oct. 2, 2021, 5:35 p.m. OK Rust TESTS 26 1184 44953600

remove filters

Back to search problems