Codeforces Round 395 (Div. 1)

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
763 Codeforces Round 395 (Div. 1) FINISHED False 7200 290363123 Feb. 2, 2017, 1:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 551 ) E Timofey and our friends animals PROGRAMMING data structures divide and conquer dsu 2800

After his birthday party, Timofey went to his favorite tree alley in a park. He wants to feed there his favorite birds — crows. It's widely known that each tree is occupied by a single crow family. The trees in the alley form a row and are numbered from 1 to n . Some families are friends to each other. For some reasons, two families can be friends only if they live not too far from each other, more precisely, there is no more than k - 1 trees between any pair of friend families. Formally, the family on the u -th tree and the family on the v -th tree can be friends only if | u - v | ≤ k holds. One of the friendship features is that if some family learns that Timofey is feeding crows somewhere, it notifies about this all friend families. Thus, after Timofey starts to feed crows under some tree, all the families that are friends to the family living on this tree, as well as their friends and so on, fly to the feeding place. Of course, the family living on the tree also comes to the feeding place. Today Timofey came to the alley and noticed that all the families that live on trees with numbers strictly less than l or strictly greater than r have flown away. Thus, it is not possible to pass the information about feeding through them. Moreover, there is no need to feed them. Help Timofey to learn what is the minimum number of trees under which he has to feed crows so that all the families that have remained will get the information about feeding. You are given several situations, described by integers l and r , you need to calculate the answer for all of them. The first line contains integers n and k ( 1 ≤ n ≤ 10 5 , 1 ≤ k ≤ 5 ), where n is the number of trees, and k is the maximum possible distance between friend families. The next line contains single integer m ( 0 ≤ m ≤ n · k ) — the number of pair of friend families. Each of the next m lines contains two integers u and v ( 1 ≤ u , v ≤ 10 5 ), that means that the families on trees u and v are friends. It is g

Tutorials

Codeforces Round #395 [Editorial]

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
24729994 Hermera E Feb. 17, 2017, 2:20 a.m. OK GNU C++ TESTS 64 171 13721600 2800
25400860 cilebritain E March 11, 2017, 9:59 a.m. OK GNU C++ TESTS 64 171 13926400 2800
41573470 Scut82 E Aug. 14, 2018, 1:49 a.m. OK GNU C++ TESTS 64 171 15769600 2800
41587739 Scut82 E Aug. 14, 2018, 12:21 p.m. OK GNU C++ TESTS 64 171 15974400 2800
24399947 AkaneSasu E Feb. 3, 2017, 2:29 a.m. OK GNU C++ TESTS 64 202 10342400 2800
41584868 Scut82 E Aug. 14, 2018, 10:27 a.m. OK GNU C++ TESTS 64 202 15667200 2800
41575207 Scut82 E Aug. 14, 2018, 3:54 a.m. OK GNU C++ TESTS 64 202 15667200 2800
24792965 lichang E Feb. 19, 2017, 2:21 a.m. OK GNU C++ TESTS 64 217 21913600 2800
27262781 jiyutian E May 21, 2017, 8:36 a.m. OK GNU C++ TESTS 64 218 11878400 2800
25221907 limuyang01 E March 4, 2017, 5:02 p.m. OK GNU C++ TESTS 64 218 15872000 2800
36290854 Pickupwin E March 15, 2018, 5:32 a.m. OK GNU C++11 TESTS 64 78 8089600 2800
40982563 ReaLNero1 E July 30, 2018, 6:28 p.m. OK GNU C++11 TESTS 64 124 20275200 2800
24628453 Wuvin E Feb. 13, 2017, 1:18 p.m. OK GNU C++11 TESTS 64 124 22323200 2800
55576497 RedStar_13 E June 15, 2019, 1:46 a.m. OK GNU C++11 TESTS 64 156 15667200 2800
51160326 zhuwanman E March 11, 2019, 12:06 p.m. OK GNU C++11 TESTS 64 171 7372800 2800
55584442 RedStar_13 E June 15, 2019, 8:40 a.m. OK GNU C++11 TESTS 64 171 15257600 2800
24603977 Talon_F E Feb. 12, 2017, 8:04 a.m. OK GNU C++11 TESTS 64 171 21708800 2800
46061933 vjudge3 E Nov. 22, 2018, 1:47 p.m. OK GNU C++11 TESTS 64 218 18944000 2800
24470887 King_George E Feb. 6, 2017, 3:10 p.m. OK GNU C++11 TESTS 64 248 24576000 2800
24470602 King_George E Feb. 6, 2017, 2:54 p.m. OK GNU C++11 TESTS 64 249 24576000 2800
34269523 Timsei E Jan. 18, 2018, 7:26 a.m. OK GNU C++14 TESTS 64 156 18739200 2800
39882175 choutii E July 3, 2018, 2:46 a.m. OK GNU C++14 TESTS 64 265 9318400 2800
59383829 TLuan E Aug. 24, 2019, 5:17 a.m. OK GNU C++14 TESTS 64 343 15769600 2800
25116481 Shik E March 1, 2017, 6:54 a.m. OK GNU C++14 TESTS 64 343 17305600 2800
24384990 lych123 E Feb. 2, 2017, 3:19 p.m. OK GNU C++14 TESTS 64 358 17100800 2800
24787238 Shik E Feb. 18, 2017, 6:44 p.m. OK GNU C++14 TESTS 64 374 17817600 2800
26483990 fqw E April 18, 2017, 8:51 p.m. OK GNU C++14 TESTS 64 389 18124800 2800
34269384 Timsei E Jan. 18, 2018, 7:20 a.m. OK GNU C++14 TESTS 64 405 18124800 2800
24427306 saliii E Feb. 4, 2017, 8 a.m. OK GNU C++14 TESTS 64 436 17203200 2800
24402210 Xin-Jie E Feb. 3, 2017, 5:24 a.m. OK GNU C++14 TESTS 64 436 17203200 2800
69033347 HeRaNO E Jan. 18, 2020, 8:34 a.m. OK GNU C++17 TESTS 64 249 2355200 2800
57949415 Shayan.P E July 29, 2019, 3:46 p.m. OK GNU C++17 TESTS 64 561 23961600 2800
60766564 Mahir83 E Sept. 18, 2019, 11:11 a.m. OK GNU C++17 TESTS 64 561 38092800 2800
50525376 lpa20020220 E Feb. 26, 2019, 11:32 a.m. OK GNU C++17 TESTS 64 561 43315200 2800
60487179 Bohun E Sept. 13, 2019, 1:04 p.m. OK GNU C++17 TESTS 64 1418 30003200 2800
60507312 w0nsh E Sept. 13, 2019, 10:45 p.m. OK GNU C++17 TESTS 64 1872 19456000 2800
46953755 vitmaann E Dec. 13, 2018, 12:25 a.m. OK GNU C++17 TESTS 64 2588 42188800 2800
60494462 Bohun E Sept. 13, 2019, 3:47 p.m. OK GNU C++17 TESTS 64 3665 20787200 2800
49633427 Rzepa E Feb. 8, 2019, 5:24 p.m. OK GNU C++17 TESTS 64 4414 130560000 2800
67781885 hjk1030 E Dec. 28, 2019, 11:16 a.m. OK GNU C++17 TESTS 64 5678 29184000 2800
24593414 fetetriste E Feb. 11, 2017, 4:23 p.m. OK Java 8 TESTS 64 1013 57344000 2800
25094031 JialinOuyang E Feb. 28, 2017, 6:35 a.m. OK Java 8 TESTS 64 1388 50688000 2800
24808633 Wolfje E Feb. 19, 2017, 6:46 p.m. OK Java 8 TESTS 64 1715 63897600 2800
24443379 IgorKoval E Feb. 5, 2017, 12:46 a.m. OK Java 8 TESTS 64 4087 55603200 2800
24443333 IgorKoval E Feb. 5, 2017, 12:36 a.m. OK Java 8 TESTS 64 4960 60416000 2800
24443339 IgorKoval E Feb. 5, 2017, 12:38 a.m. OK Java 8 TESTS 64 4976 60416000 2800
24443352 IgorKoval E Feb. 5, 2017, 12:41 a.m. OK Java 8 TESTS 64 5132 60416000 2800
24443323 IgorKoval E Feb. 5, 2017, 12:35 a.m. OK Java 8 TESTS 64 5553 60416000 2800
24393682 uwi E Feb. 2, 2017, 6:50 p.m. OK Java 8 TESTS 64 6692 41881600 2800
24468519 AleksanderBalobanov E Feb. 6, 2017, 12:50 p.m. OK MS C++ TESTS 64 1747 53760000 2800
24388339 DEGwer E Feb. 2, 2017, 4:26 p.m. OK MS C++ TESTS 64 5537 77721600 2800

remove filters

Back to search problems