Codeforces Round 621 (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
1307 Codeforces Round 621 (Div. 1 + Div. 2) FINISHED False 8100 149869499 Feb. 17, 2020, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 592 ) F Cow and Vacation PROGRAMMING dfs and similar ds trees 3200

B'Bessie is planning a vacation! In Cow-lifornia, there are n cities, with n-1 bidirectional roads connecting them. It is guaranteed that one can reach any city from any other city. Bessie is considering v possible vacation plans, with the i -th one consisting of a start city a_i and destination city b_i . It is known that only r of the cities have rest stops. Bessie gets tired easily, and cannot travel across more than k consecutive roads without resting. In fact, she is so desperate to rest that she may travel through the same city multiple times in order to do so. For each of the vacation plans, does there exist a way for Bessie to travel from the starting city to the destination city? The first line contains three integers n , k , and r ( 2 <= n <= 2 cdot 10^5 , 1 <= k,r <= n ) -- the number of cities, the maximum number of roads Bessie is willing to travel through in a row without resting, and the number of rest stops. Each of the following n-1 lines contain two integers x_i and y_i ( 1 <= x_i, y_i <= n , x_i neq y_i ), meaning city x_i and city y_i are connected by a road. The next line contains r integers separated by spaces -- the cities with rest stops. Each city will appear at most once. The next line contains v ( 1 <= v <= 2 cdot 10^5 ) -- the number of vacation plans. Each of the following v lines contain two integers a_i and b_i ( 1 <= a_i, b_i <= n , a_i ne b_i ) -- the start and end city of the vacation plan. If Bessie can reach her destination without traveling across more than k roads without resting for the i -th vacation plan, print YES. Otherwise, print NO. The graph for the first example is shown below. The rest stop is denoted by red. For the first query, Bessie can visit these cities in order: 1, 2, 3 . For the second query, Bessie can visit'...

Tutorials

Codeforces Round #621 (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
71483730 luogu_bot1 F Feb. 20, 2020, 9:22 a.m. OK GNU C11 TESTS 75 545 63385600 3200
71348282 hi_im_bad2 F Feb. 18, 2020, 2:10 a.m. OK GNU C++11 TESTS 75 420 65433600 3200
71377871 Frame233 F Feb. 18, 2020, 12:55 p.m. OK GNU C++11 TESTS 75 577 59289600 3200
71420975 Binary_Search_Tree F Feb. 19, 2020, 7:32 a.m. OK GNU C++11 TESTS 75 592 77312000 3200
71358835 EricHuang2003 F Feb. 18, 2020, 6:58 a.m. OK GNU C++11 TESTS 75 607 57753600 3200
71614804 msuwakow F Feb. 22, 2020, 1:40 p.m. OK GNU C++11 TESTS 75 639 67788800 3200
71363894 idxcalcal F Feb. 18, 2020, 8:37 a.m. OK GNU C++11 TESTS 75 655 72396800 3200
71373256 Pigbrain F Feb. 18, 2020, 11:42 a.m. OK GNU C++11 TESTS 75 686 59084800 3200
71354791 Binary_Search_Tree F Feb. 18, 2020, 5:33 a.m. OK GNU C++11 TESTS 75 716 77312000 3200
71419194 wf9036 F Feb. 19, 2020, 6:51 a.m. OK GNU C++11 TESTS 75 717 66867200 3200
71388999 Bruteforceman F Feb. 18, 2020, 3:45 p.m. OK GNU C++11 TESTS 75 717 67276800 3200
71387397 Crazy_Diamond F Feb. 18, 2020, 3:16 p.m. OK GNU C++14 TESTS 75 420 50483200 3200
71386768 QAQAutoMaton F Feb. 18, 2020, 3:06 p.m. OK GNU C++14 TESTS 75 592 74137600 3200
71554124 Scut82 F Feb. 21, 2020, 1:54 p.m. OK GNU C++14 TESTS 75 701 63795200 3200
71388065 Warawreh F Feb. 18, 2020, 3:28 p.m. OK GNU C++14 TESTS 75 717 69632000 3200
71401633 DmitryGrigorev F Feb. 18, 2020, 7:46 p.m. OK GNU C++14 TESTS 75 732 78643200 3200
71350459 ZZZZZZZZZZZZZZZZZZ F Feb. 18, 2020, 3:31 a.m. OK GNU C++14 TESTS 75 763 66969600 3200
71343818 nweeks F Feb. 17, 2020, 10:17 p.m. OK GNU C++14 TESTS 75 764 74752000 3200
71553980 Scut82 F Feb. 21, 2020, 1:52 p.m. OK GNU C++14 TESTS 75 780 65331200 3200
71375329 AnnieCai F Feb. 18, 2020, 12:17 p.m. OK GNU C++14 TESTS 75 780 66969600 3200
71503709 MarcosK F Feb. 20, 2020, 3:38 p.m. OK GNU C++14 TESTS 75 780 78336000 3200
71470805 saketh F Feb. 20, 2020, 3:46 a.m. OK GNU C++17 TESTS 75 280 25190400 3200
71471246 saketh F Feb. 20, 2020, 4:02 a.m. OK GNU C++17 TESTS 75 296 25497600 3200
71507882 neal F Feb. 20, 2020, 5 p.m. OK GNU C++17 TESTS 75 312 25497600 3200
71507658 neal F Feb. 20, 2020, 4:56 p.m. OK GNU C++17 TESTS 75 342 25497600 3200
71469574 saketh F Feb. 20, 2020, 2:55 a.m. OK GNU C++17 TESTS 75 342 33484800 3200
71470013 saketh F Feb. 20, 2020, 3:13 a.m. OK GNU C++17 TESTS 75 343 31948800 3200
71340006 neal F Feb. 17, 2020, 8:18 p.m. OK GNU C++17 TESTS 75 343 40550400 3200
71470382 saketh F Feb. 20, 2020, 3:29 a.m. OK GNU C++17 TESTS 75 358 28672000 3200
71470249 saketh F Feb. 20, 2020, 3:23 a.m. OK GNU C++17 TESTS 75 358 28672000 3200
71469433 saketh F Feb. 20, 2020, 2:48 a.m. OK GNU C++17 TESTS 75 358 33484800 3200
71421506 dalt F Feb. 19, 2020, 7:43 a.m. OK Java 8 TESTS 75 1934 198348800 3200
71516367 polyakoff F Feb. 20, 2020, 8:20 p.m. OK Java 8 TESTS 75 1965 268390400 3200
71452032 Spheniscine F Feb. 19, 2020, 5:02 p.m. OK Kotlin TESTS 75 1231 217600000 3200
71471062 Spheniscine F Feb. 20, 2020, 3:56 a.m. OK Kotlin TESTS 75 1232 217702400 3200
71472140 Spheniscine F Feb. 20, 2020, 4:35 a.m. OK Kotlin TESTS 75 1247 217702400 3200
71450879 Spheniscine F Feb. 19, 2020, 4:41 p.m. OK Kotlin TESTS 75 1278 217600000 3200
71471954 Spheniscine F Feb. 20, 2020, 4:29 a.m. OK Kotlin TESTS 75 1325 217702400 3200
71449708 Spheniscine F Feb. 19, 2020, 4:21 p.m. OK Kotlin TESTS 75 1341 217702400 3200
71449959 Spheniscine F Feb. 19, 2020, 4:25 p.m. OK Kotlin TESTS 75 1450 217702400 3200
71498959 tarattata1 F Feb. 20, 2020, 2:16 p.m. OK MS C++ TESTS 75 1201 77721600 3200

remove filters

Back to search problems