Codeforces Round 962 (Div. 3)

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
1996 Codeforces Round 962 (Div. 3) FINISHED False 9000 54401123 July 26, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 2267 ) G Penacony PROGRAMMING brute force data structures dp hashing

On Penacony, The Land of the Dreams, there exists n houses and n roads. There exists a road between house i and i+1 for all 1 <= q i <= q n-1 and a road between house n and house 1 . All roads are bidirectional. However, due to the crisis on Penacony, the overseeing family has gone into debt and may not be able to maintain all roads. There are m pairs of friendships between the residents of Penacony. If the resident living in house a is friends with the resident living in house b , there must be a path between houses a and b through maintained roads. What is the minimum number of roads that must be maintained? The first line contains t ( 1 <= q t <= q 10^4 ) – the number of test cases. The first line of each test case contains two integers n and m ( 3 <= q n <= q 2 cdot 10^5, 1 <= q m <= q 2 cdot 10^5 ) – the number of houses and the number of friendships. The next m lines contain two integers a and b ( 1 <= q a < b <= q n ) – the resident in house a is friends with the resident in house b . It is guaranteed all ( a, b ) are distinct. It is guaranteed the sum of n and m over all test cases does not exceed 2 cdot 10^5 . For each test case, output an integer, the minimum number of roads that must be maintained. For the first test case, the following roads must be maintained:

Tutorials

Codeforces Round 962 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
272903330 Sunnynotsan1 G July 27, 2024, 4:39 a.m. OK C++14 (GCC 6-32) TESTS 25 233 6348800
272861367 Yukii_P G July 26, 2024, 6:25 p.m. OK C++14 (GCC 6-32) TESTS 25 312 6348800
272883279 Ylx03 G July 27, 2024, 12:02 a.m. OK C++14 (GCC 6-32) TESTS 25 436 49561600
272910620 xieyijie G July 27, 2024, 5:46 a.m. OK C++14 (GCC 6-32) TESTS 25 515 6451200
272894486 Nightsky-yekong G July 27, 2024, 3:01 a.m. OK C++14 (GCC 6-32) TESTS 25 640 24166400
272903592 Sunlight G July 27, 2024, 4:41 a.m. OK C++14 (GCC 6-32) TESTS 25 1015 10240000
272903634 Sunlight G July 27, 2024, 4:42 a.m. OK C++14 (GCC 6-32) TESTS 25 1061 10137600
272903418 Sunlight G July 27, 2024, 4:40 a.m. OK C++14 (GCC 6-32) TESTS 25 1077 10137600
272853038 zoinkssss G July 26, 2024, 5:31 p.m. OK C++14 (GCC 6-32) TESTS 25 1140 27852800
272850378 Sunlight G July 26, 2024, 5:04 p.m. OK C++14 (GCC 6-32) TESTS 25 1500 10137600
272892795 Rororna G July 27, 2024, 2:43 a.m. OK C++17 (GCC 7-32) TESTS 25 186 5529600
272891468 Chengyx G July 27, 2024, 2:26 a.m. OK C++17 (GCC 7-32) TESTS 25 186 5529600
272896792 D1stance G July 27, 2024, 3:26 a.m. OK C++17 (GCC 7-32) TESTS 25 186 6348800
272904609 freakin23 G July 27, 2024, 4:52 a.m. OK C++17 (GCC 7-32) TESTS 25 202 13619200
272892436 StenSoSmol G July 27, 2024, 2:39 a.m. OK C++17 (GCC 7-32) TESTS 25 203 6451200
272893822 Wt_vic G July 27, 2024, 2:54 a.m. OK C++17 (GCC 7-32) TESTS 25 218 6348800
272888478 RE_PZheng G July 27, 2024, 1:50 a.m. OK C++17 (GCC 7-32) TESTS 25 218 6348800
272880080 BigBadWolf G July 26, 2024, 10:39 p.m. OK C++17 (GCC 7-32) TESTS 25 218 6451200
272891885 brute_forceCE G July 27, 2024, 2:32 a.m. OK C++17 (GCC 7-32) TESTS 25 233 6348800
272902229 qikala7777 G July 27, 2024, 4:27 a.m. OK C++17 (GCC 7-32) TESTS 25 233 12800000
272858686 neal G July 26, 2024, 6:05 p.m. OK C++20 (GCC 13-64) TESTS 25 62 102400
272858526 neal G July 26, 2024, 6:04 p.m. OK C++20 (GCC 13-64) TESTS 25 62 102400
272858303 neal G July 26, 2024, 6:02 p.m. OK C++20 (GCC 13-64) TESTS 25 62 102400
272859731 neal G July 26, 2024, 6:13 p.m. OK C++20 (GCC 13-64) TESTS 25 77 102400
272859654 neal G July 26, 2024, 6:12 p.m. OK C++20 (GCC 13-64) TESTS 25 77 102400
272859642 neal G July 26, 2024, 6:12 p.m. OK C++20 (GCC 13-64) TESTS 25 77 102400
272858563 neal G July 26, 2024, 6:04 p.m. OK C++20 (GCC 13-64) TESTS 25 77 102400
272858632 neal G July 26, 2024, 6:05 p.m. OK C++20 (GCC 13-64) TESTS 25 78 102400
272858730 neal G July 26, 2024, 6:05 p.m. OK C++20 (GCC 13-64) TESTS 25 93 102400
272858602 neal G July 26, 2024, 6:04 p.m. OK C++20 (GCC 13-64) TESTS 25 93 102400
272875888 motorsponge G July 26, 2024, 9:21 p.m. OK GNU C11 TESTS 25 93 4915200
272855362 rainboy G July 26, 2024, 5:42 p.m. OK GNU C11 TESTS 25 109 2457600
272853727 Dukkha G July 26, 2024, 5:34 p.m. OK Java 21 TESTS 25 1717 40140800
272879847 white___devil G July 26, 2024, 10:35 p.m. OK Java 8 TESTS 25 733 15667200
272854324 shilpabanerjee50 G July 26, 2024, 5:35 p.m. OK PyPy 3 TESTS 25 1014 45363200
272882853 golomb G July 26, 2024, 11:51 p.m. OK PyPy 3-64 TESTS 25 500 20172800
272902697 young_skywalker_ G July 27, 2024, 4:32 a.m. OK PyPy 3-64 TESTS 25 609 66355200
272890998 lucasschnee G July 27, 2024, 2:21 a.m. OK PyPy 3-64 TESTS 25 874 62873600
272891207 lucasschnee G July 27, 2024, 2:23 a.m. OK PyPy 3-64 TESTS 25 1030 69734400

remove filters

Back to search problems