Codeforces Round 778 (Div. 1 + Div. 2, based on Technocup 2022 Final Round)

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
1654 Codeforces Round 778 (Div. 1 + Div. 2, based on Technocup 2022 Final Round) FINISHED False 8100 89403863 March 20, 2022, 11:35 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 411 ) G Snowy Mountain PROGRAMMING data structures graphs greedy shortest paths trees 2900

B'There are n locations on a snowy mountain range (numbered from 1 to n ), connected by n-1 trails in the shape of a tree. Each trail has length 1 . Some of the locations are base lodges. The height h_i of each location is equal to the distance to the nearest base lodge (a base lodge has height 0 ). There is a skier at each location, each skier has initial kinetic energy 0 . Each skier wants to ski along as many trails as possible. Suppose that the skier is skiing along a trail from location i to j . Skiers are not allowed to ski uphill (i.e., if h_i < h_j ). It costs one unit of kinetic energy to ski along flat ground (i.e., if h_i = h_j ), and a skier gains one unit of kinetic energy by skiing downhill (i.e., if h_i > h_j ). For each location, compute the length of the longest sequence of trails that the skier starting at that location can ski along without their kinetic energy ever becoming negative. Skiers are allowed to visit the same location or trail multiple times. The first line contains a single integer n ( 2 <= n <= 2 cdot 10^5 ). The second line contains n integers l_1, l_2, ldots, l_n ( 0 <= l_i <= 1 ). If l_i = 1 , location i is a base lodge; if l_i = 0 , location i is not a base lodge. It is guaranteed that there is at least 1 base lodge. Each of the next n-1 lines contains two integers u, v ( 1 <= q u, v <= q n , u neq v ), meaning that there is a trail that connects the locations u and v . It is guaranteed that the given trails form a tree. Print n integers: the i -th integer is equal to the length of the longest sequence of trails that the skier starting at location i can ski along without their kinetic energy ever becoming negative. In the first test, h = [0, 0, 1, 1, 2, 3] . The skier starting from 6 can ski along at most 5 trails, in the path $'...

Tutorials

Editorial of Codeforces Round #778 (Div. 1 + Div. 2, based on Technocup 2022 Final Round)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
150311017 Tyyyyyy G March 21, 2022, 12:06 a.m. OK GNU C++14 TESTS 160 249 15052800 2900
150317170 eecs G March 21, 2022, 3:20 a.m. OK GNU C++14 TESTS 160 280 17612800 2900
150317135 eecs G March 21, 2022, 3:19 a.m. OK GNU C++14 TESTS 160 296 21196800 2900
150265515 ugly2333 G March 20, 2022, 1:25 p.m. OK GNU C++14 TESTS 158 343 16384000 2900
150299206 Golovanov399 G March 20, 2022, 7:23 p.m. OK GNU C++17 TESTS 160 717 23859200 2900
150291434 Golovanov399 G March 20, 2022, 5:36 p.m. OK GNU C++17 TESTS 160 826 27443200 2900
150262682 Golovanov399 G March 20, 2022, 1:11 p.m. OK GNU C++17 TESTS 158 2823 543027200 2900
150268570 ainta G March 20, 2022, 1:39 p.m. OK GNU C++17 (64) TESTS 158 312 32153600 2900
150275916 Pechalka G March 20, 2022, 2:54 p.m. OK GNU C++17 (64) TESTS 158 373 31641600 2900
150320079 EndSinger G March 21, 2022, 4:33 a.m. OK GNU C++17 (64) TESTS 160 561 32153600 2900
150288345 emorgan5289 G March 20, 2022, 5:01 p.m. OK GNU C++17 (64) TESTS 160 1435 1059225600 2900
150264693 orzdevinwang G March 20, 2022, 1:21 p.m. OK GNU C++17 (64) TESTS 158 1590 70041600 2900
150270995 he_____hezhou G March 20, 2022, 1:48 p.m. OK GNU C++17 (64) TESTS 158 1668 33689600 2900
150314271 Sana G March 21, 2022, 1:57 a.m. OK GNU C++17 (64) TESTS 160 1669 119193600 2900
150262802 slime G March 20, 2022, 1:12 p.m. OK GNU C++17 (64) TESTS 158 3619 76492800 2900
150279932 slime G March 20, 2022, 3:30 p.m. OK GNU C++17 (64) TESTS 159 4960 221696000 2900
150288412 brunovsky G March 20, 2022, 5:02 p.m. OK GNU C++20 (64) TESTS 160 280 41062400 2900
150319536 couplefire G March 21, 2022, 4:21 a.m. OK GNU C++20 (64) TESTS 160 343 23756800 2900
150320449 Gary2005 G March 21, 2022, 4:41 a.m. OK GNU C++20 (64) TESTS 160 576 33484800 2900
150314714 yzc2005 G March 21, 2022, 2:11 a.m. OK GNU C++20 (64) TESTS 160 623 25292800 2900
150293045 353cerega G March 20, 2022, 5:56 p.m. OK GNU C++20 (64) TESTS 160 732 32665600 2900
150314513 Alan233 G March 21, 2022, 2:05 a.m. OK GNU C++20 (64) TESTS 160 763 542720000 2900
150275186 SomethingNew G March 20, 2022, 2:50 p.m. OK GNU C++20 (64) TESTS 158 779 27750400 2900
150281329 Ormlis G March 20, 2022, 3:44 p.m. OK GNU C++20 (64) TESTS 159 780 32563200 2900
150262050 Vercingetorix G March 20, 2022, 1:08 p.m. OK GNU C++20 (64) TESTS 158 794 37785600 2900
150314540 Alan233 G March 21, 2022, 2:06 a.m. OK GNU C++20 (64) TESTS 160 842 542720000 2900
150277538 sansen G March 20, 2022, 3:08 p.m. OK Rust 2021 TESTS 159 342 71680000 2900
150276389 sansen G March 20, 2022, 2:58 p.m. OK Rust 2021 TESTS 158 405 71680000 2900
150271209 Egor G March 20, 2022, 1:48 p.m. OK Rust 2021 TESTS 158 483 42188800 2900

remove filters

Back to search problems