Codeforces Round 858 (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
1806 Codeforces Round 858 (Div. 2) FINISHED False 8100 58125262 March 18, 2023, 12:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 955 ) D DSU Master PROGRAMMING combinatorics dp ds math

B'You are given an integer n and an array a of length n-1 whose elements are either 0 or 1 . Let us define the value of a permutation ^ dagger p of length m-1 ( m <= q n ) by the following process. Let G be a graph of m vertices labeled from 1 to m that does not contain any edges. For each i from 1 to m-1 , perform the following operations: Then, the value of p is the number of incoming edges of vertex 1 of G . For each k from 1 to n-1 , find the sum of values of all k! permutations of length k . Since this value can be big, you are only required to compute this value under modulo 998 ,244 ,353 . ^ dagger A permutation of length n is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation ( 2 appears twice in the array), and [1,3,4] is also not a permutation ( n=3 but there is 4 in the array). ^ ddagger The weakly connected components of a directed graph is the same as the components of the undirected version of the graph. Formally, for directed graph G , define a graph H where for all edges a to b in G , you add an undirected edge a <= ftrightarrow b in H . Then the weakly connected components of G are the components of H . ^{ dagger dagger} Note that a vertex that has no edges is considered to have only incoming edges. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains a single integer n ( 2 <= n <= 5 cdot 10^5 ). The second line of each test case contains n-1 integers a_1, a_2, ldots, a_{n-1} ( a_i is 0 or 1 ). It is guaranteed that t'...

Tutorials

Codeforces Round #858 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
197983998 Tdyx D March 18, 2023, 3:31 p.m. OK C# 10 TESTS 29 264 79564800
198040378 pengyule D March 19, 2023, 4:26 a.m. OK GNU C++14 TESTS 29 171 3993600
197972473 -Complex- D March 18, 2023, 2:17 p.m. OK GNU C++14 TESTS 29 187 24064000
197977565 VinstaG173 D March 18, 2023, 2:55 p.m. OK GNU C++14 TESTS 29 202 0
197977345 shiyihangxs D March 18, 2023, 2:54 p.m. OK GNU C++14 TESTS 29 202 12083200
198044471 Sai_Sravan_19 D March 19, 2023, 5:24 a.m. OK GNU C++14 TESTS 29 218 3993600
198032083 mazihang2022 D March 19, 2023, 1:32 a.m. OK GNU C++14 TESTS 29 218 3993600
197985291 MhfyW D March 18, 2023, 3:40 p.m. OK GNU C++14 TESTS 29 218 6656000
198034897 lbntxdy D March 19, 2023, 2:36 a.m. OK GNU C++14 TESTS 29 218 7987200
198048239 Max_s_xaM D March 19, 2023, 6:02 a.m. OK GNU C++14 TESTS 29 218 10035200
198035241 Star32 D March 19, 2023, 2:43 a.m. OK GNU C++14 TESTS 29 218 11980800
198045495 Small_Black D March 19, 2023, 5:36 a.m. OK GNU C++17 TESTS 29 187 6348800
197983440 vjudge5 D March 18, 2023, 3:28 p.m. OK GNU C++17 TESTS 29 218 0
198035681 fzzsl D March 19, 2023, 2:52 a.m. OK GNU C++17 TESTS 29 218 3993600
197975878 realcomplex D March 18, 2023, 2:47 p.m. OK GNU C++17 TESTS 29 218 6041600
198041712 newman111 D March 19, 2023, 4:48 a.m. OK GNU C++17 TESTS 29 218 8499200
198040964 newman111 D March 19, 2023, 4:36 a.m. OK GNU C++17 TESTS 29 218 8499200
197977323 ITworker_Z D March 18, 2023, 2:53 p.m. OK GNU C++17 TESTS 29 233 11980800
197978983 zlc1114 D March 18, 2023, 3:02 p.m. OK GNU C++17 TESTS 29 234 12083200
197998609 regain0001 D March 18, 2023, 5:21 p.m. OK GNU C++17 TESTS 29 248 44134400
198034942 mwen D March 19, 2023, 2:37 a.m. OK GNU C++17 TESTS 29 249 0
197977230 Kzos_017 D March 18, 2023, 2:53 p.m. OK GNU C++17 (64) TESTS 29 124 0
197975958 minato D March 18, 2023, 2:48 p.m. OK GNU C++17 (64) TESTS 29 140 3993600
197985278 MCYang D March 18, 2023, 3:39 p.m. OK GNU C++17 (64) TESTS 29 155 0
198037963 Legend_dy D March 19, 2023, 3:40 a.m. OK GNU C++17 (64) TESTS 29 155 6041600
198037265 black_trees D March 19, 2023, 3:27 a.m. OK GNU C++17 (64) TESTS 29 156 2048000
197976878 Andreasyan D March 18, 2023, 2:51 p.m. OK GNU C++17 (64) TESTS 29 156 10035200
198021491 ocelo7 D March 18, 2023, 9:13 p.m. OK GNU C++17 (64) TESTS 29 171 12083200
198000375 YocyCraft D March 18, 2023, 5:34 p.m. OK GNU C++17 (64) TESTS 29 171 18022400
198030999 pigpigger D March 19, 2023, 1:03 a.m. OK GNU C++17 (64) TESTS 29 280 16076800
198035159 jinqihao2026 D March 19, 2023, 2:42 a.m. OK GNU C++17 (64) TESTS 29 436 7987200
198032266 bnu20DT D March 19, 2023, 1:36 a.m. OK GNU C++20 (64) TESTS 29 108 2048000
198014944 silxi D March 18, 2023, 7:48 p.m. OK GNU C++20 (64) TESTS 29 109 2048000
197984920 200815147 D March 18, 2023, 3:37 p.m. OK GNU C++20 (64) TESTS 29 109 2048000
197973162 CDuongg D March 18, 2023, 2:19 p.m. OK GNU C++20 (64) TESTS 29 109 2048000
197998615 zzz27 D March 18, 2023, 5:21 p.m. OK GNU C++20 (64) TESTS 29 109 3993600
198040429 bxhnb D March 19, 2023, 4:27 a.m. OK GNU C++20 (64) TESTS 29 109 4300800
198041765 GALA D March 19, 2023, 4:49 a.m. OK GNU C++20 (64) TESTS 29 109 6041600
197999539 Thienu D March 18, 2023, 5:28 p.m. OK GNU C++20 (64) TESTS 29 109 6041600
198045148 rixiguafucunji D March 19, 2023, 5:32 a.m. OK GNU C++20 (64) TESTS 29 109 7987200
197986241 aibark D March 18, 2023, 3:47 p.m. OK GNU C++20 (64) TESTS 29 109 10035200
198036616 bpdolson D March 19, 2023, 3:12 a.m. OK PyPy 3 TESTS 29 920 50380800
198031155 loop_invariant D March 19, 2023, 1:08 a.m. OK PyPy 3-64 TESTS 29 327 60211200
197988494 bronze_coder D March 18, 2023, 4:03 p.m. OK PyPy 3-64 TESTS 29 343 70246400
198010821 ivatopuria D March 18, 2023, 7:05 p.m. OK PyPy 3-64 TESTS 29 389 55296000
198011392 ivatopuria D March 18, 2023, 7:11 p.m. OK PyPy 3-64 TESTS 29 389 55398400
198028597 A_G D March 18, 2023, 11:49 p.m. OK PyPy 3-64 TESTS 29 420 51814400
198011162 ivatopuria D March 18, 2023, 7:09 p.m. OK PyPy 3-64 TESTS 29 420 55398400
198010942 ivatopuria D March 18, 2023, 7:07 p.m. OK PyPy 3-64 TESTS 29 420 55398400
198001051 aashrithreddypeddi D March 18, 2023, 5:40 p.m. OK Python 3 TESTS 29 1247 13209600
198000838 mdshadesh D March 18, 2023, 5:38 p.m. OK Python 3 TESTS 29 1247 13209600

remove filters

Back to search problems