Codeforces Round 926 (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
1929 Codeforces Round 926 (Div. 2) FINISHED False 7200 29172263 Feb. 15, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 4969 ) D Sasha and a Walk in the City PROGRAMMING combinatorics dfs and similar dp math trees

B'Sasha wants to take a walk with his girlfriend in the city. The city consists of n intersections, numbered from 1 to n . Some of them are connected by roads, and from any intersection, there is exactly one simple path ^{ dagger} to any other intersection. In other words, the intersections and the roads between them form a tree. Some of the intersections are considered dangerous. Since it is unsafe to walk alone in the city, Sasha does not want to visit three or more dangerous intersections during the walk. Sasha calls a set of intersections good if the following condition is satisfied: However, Sasha does not know which intersections are dangerous, so he is interested in the number of different good sets of intersections in the city. Since this number can be very large, output it modulo 998 ,244 ,353 . ^{ dagger} A simple path is a path that passes through each intersection at most once. Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 2 <= n <= q 3 cdot 10^5 ) -- the number of intersections in the city. The next (n - 1) lines describe the roads. The i -th line contains two integers u_i and v_i ( 1 <= q u_i, v_i <= q n , u_i ne v_i ) -- the numbers of the intersections connected by the i -th road. It is guaranteed that these roads form a tree. It is guaranteed that the sum of n over all test cases does not exceed 3 cdot 10^5 . For each test case, output a single integer -- the number of good sets of intersections modulo 998 ,244 ,353 . In the first test case, there are 2^3 = 8 sets of intersections. All of them are good, except for the set {1, 2, 3 } , because if intersections 1, 2 , and 3 are dangerous, then the simple path 1 - 2'...

Tutorials

Codeforces Round #926 (Div. 2) Editorial.

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
246562425 _Kruskal_ D Feb. 15, 2024, 4:31 p.m. OK C# 10 TESTS 18 623 70860800
246606283 Andy_Lin D Feb. 16, 2024, 1:41 a.m. OK GNU C++17 TESTS 21 187 19353600
246609037 Simex D Feb. 16, 2024, 2:38 a.m. OK GNU C++17 TESTS 22 187 31846400
246608605 jiangzhihui D Feb. 16, 2024, 2:29 a.m. OK GNU C++17 TESTS 21 218 24576000
246572519 zrj66 D Feb. 15, 2024, 5:35 p.m. OK GNU C++17 TESTS 20 218 48537600
246600637 int65536 D Feb. 15, 2024, 11:09 p.m. OK GNU C++17 TESTS 21 233 20684800
246577394 Mkswll D Feb. 15, 2024, 6:12 p.m. OK GNU C++17 TESTS 20 233 32256000
246580322 llzer D Feb. 15, 2024, 6:36 p.m. OK GNU C++17 TESTS 20 248 29593600
246597586 shinhs D Feb. 15, 2024, 10:02 p.m. OK GNU C++17 TESTS 21 249 16691200
246577054 orzymandias D Feb. 15, 2024, 6:09 p.m. OK GNU C++17 TESTS 20 249 23142400
246591236 Rashedunnabi D Feb. 15, 2024, 8:31 p.m. OK GNU C++17 TESTS 21 249 24780800
246565896 yzr233 D Feb. 15, 2024, 4:57 p.m. OK GNU C++17 (64) TESTS 18 186 36249600
246566209 Ackerlanna D Feb. 15, 2024, 4:58 p.m. OK GNU C++17 (64) TESTS 18 186 46284800
246556941 tokitsukaze D Feb. 15, 2024, 4:17 p.m. OK GNU C++17 (64) TESTS 18 202 43622400
246557423 SoyTony D Feb. 15, 2024, 4:19 p.m. OK GNU C++17 (64) TESTS 18 217 35532800
246572268 sqqqqqqqqy D Feb. 15, 2024, 5:33 p.m. OK GNU C++17 (64) TESTS 20 217 57753600
246581039 Bai_xiaobo D Feb. 15, 2024, 6:43 p.m. OK GNU C++17 (64) TESTS 20 217 100454400
246606934 XZQQWQ D Feb. 16, 2024, 1:57 a.m. OK GNU C++17 (64) TESTS 21 218 45158400
246613696 a999999 D Feb. 16, 2024, 3:57 a.m. OK GNU C++17 (64) TESTS 23 218 47411200
246565763 wuzihan D Feb. 15, 2024, 4:57 p.m. OK GNU C++17 (64) TESTS 18 218 51609600
246614923 Lu_xZ D Feb. 16, 2024, 4:16 a.m. OK GNU C++17 (64) TESTS 23 233 41574400
246609102 Yoralen D Feb. 16, 2024, 2:40 a.m. OK GNU C++20 (64) TESTS 22 109 56012800
246610208 Golem__ D Feb. 16, 2024, 3 a.m. OK GNU C++20 (64) TESTS 23 124 60825600
246587165 Huaizhi D Feb. 15, 2024, 7:45 p.m. OK GNU C++20 (64) TESTS 20 140 32665600
246570768 Nienie0730 D Feb. 15, 2024, 5:23 p.m. OK GNU C++20 (64) TESTS 19 140 41574400
246621905 kjhhjki D Feb. 16, 2024, 5:51 a.m. OK GNU C++20 (64) TESTS 25 156 47206400
246566843 Raywithyou D Feb. 15, 2024, 5:01 p.m. OK GNU C++20 (64) TESTS 18 171 30924800
246559739 smallfangAKIOI D Feb. 15, 2024, 4:25 p.m. OK GNU C++20 (64) TESTS 18 171 40755200
246579691 yimg D Feb. 15, 2024, 6:31 p.m. OK GNU C++20 (64) TESTS 20 171 47513600
246579415 yimg D Feb. 15, 2024, 6:28 p.m. OK GNU C++20 (64) TESTS 20 171 47513600
246621861 kjhhjki D Feb. 16, 2024, 5:50 a.m. OK GNU C++20 (64) TESTS 25 171 53964800
246619259 priyaroy3370 D Feb. 16, 2024, 5:18 a.m. OK Java 21 TESTS 23 811 116838400
246567110 mapleKing D Feb. 15, 2024, 5:02 p.m. OK Java 21 TESTS 18 951 93593600
246616380 man-ray D Feb. 16, 2024, 4:38 a.m. OK Java 21 TESTS 23 1075 110796800
246616319 man-ray D Feb. 16, 2024, 4:37 a.m. OK Java 21 TESTS 23 1185 108236800
246613211 powervic08 D Feb. 16, 2024, 3:50 a.m. OK Java 21 TESTS 23 1201 110284800
246575893 santanu021 D Feb. 15, 2024, 6 p.m. OK Java 21 TESTS 20 1294 128409600
246561950 Ligh0x74 D Feb. 15, 2024, 4:30 p.m. OK Java 21 TESTS 18 1309 114790400
246560577 saptarshi1729 D Feb. 15, 2024, 4:27 p.m. OK Java 21 TESTS 18 1403 247705600
246569440 vatsal_04 D Feb. 15, 2024, 5:14 p.m. OK Java 8 TESTS 19 967 105369600
246559369 wangchaohui D Feb. 15, 2024, 4:24 p.m. OK Kotlin 1.9 TESTS 18 1341 235212800
246560404 Vasily_PML30 D Feb. 15, 2024, 4:27 p.m. OK Kotlin 1.9 TESTS 18 1996 261632000
246591524 6ziv D Feb. 15, 2024, 8:35 p.m. OK MS C++ 2017 TESTS 21 655 20172800
246581724 OLOGY D Feb. 15, 2024, 6:49 p.m. OK PyPy 2 TESTS 20 779 65024000
246578332 OLOGY D Feb. 15, 2024, 6:19 p.m. OK PyPy 2 TESTS 20 1294 99430400
246569774 Nullz D Feb. 15, 2024, 5:17 p.m. OK PyPy 3-64 TESTS 19 608 62566400
246594241 SoleProprietor D Feb. 15, 2024, 9:11 p.m. OK PyPy 3-64 TESTS 21 655 70553600
246567341 Little_Sheep_Yawn D Feb. 15, 2024, 5:03 p.m. OK PyPy 3-64 TESTS 18 670 83660800
246593494 SoleProprietor D Feb. 15, 2024, 9:01 p.m. OK PyPy 3-64 TESTS 21 701 73318400
246559397 mikeac D Feb. 15, 2024, 4:24 p.m. OK PyPy 3-64 TESTS 18 733 75366400
246574630 googlweknoall D Feb. 15, 2024, 5:50 p.m. OK PyPy 3-64 TESTS 20 826 83968000
246618942 Remineva D Feb. 16, 2024, 5:14 a.m. OK PyPy 3-64 TESTS 23 841 69939200
246576272 Quick-One D Feb. 15, 2024, 6:03 p.m. OK PyPy 3-64 TESTS 20 857 75878400
246587688 codingfennel D Feb. 15, 2024, 7:51 p.m. OK PyPy 3-64 TESTS 20 982 105267200
246594352 cs1g D Feb. 15, 2024, 9:13 p.m. OK PyPy 3-64 TESTS 21 998 88678400
246590904 OLOGY D Feb. 15, 2024, 8:27 p.m. OK Python 2 TESTS 21 1450 71680000
246581755 OLOGY D Feb. 15, 2024, 6:50 p.m. OK Python 2 TESTS 20 1481 71680000
246588747 OLOGY D Feb. 15, 2024, 8:02 p.m. OK Python 2 TESTS 21 1637 76492800
246578060 krism D Feb. 15, 2024, 6:17 p.m. OK Python 3 TESTS 20 1700 120934400
246567493 mutbuffereduint512_t D Feb. 15, 2024, 5:04 p.m. OK Rust 2021 TESTS 18 217 60518400
246557694 inverse_ackerman D Feb. 15, 2024, 4:19 p.m. OK Rust 2021 TESTS 18 218 62873600
246570738 tomarint D Feb. 15, 2024, 5:22 p.m. OK Rust 2021 TESTS 19 374 85504000

remove filters

Back to search problems