Problem Statement You are given a sequence A=(A 1 ,A 2 ,…,A N ) of length N and an…
- User
Problem Statement You are given a sequence A=(A 1 ,A 2 ,…,A N ) of length N and an integer K. There are 2 N−1 ways to divide A into several contiguous subsequences. How many of these divisions have no subsequence whose elements sum to K? Find the count modulo 998244353.
Here, "to divide A into several contiguous subsequences" means the following procedure.
Freely choose the number k (1≤k≤N) of subsequences and an integer sequence (i 1 ,i 2 ,…,i k ,i k+1 ) satisfying 1=i 1 <i 2 <⋯<i k <i k+1 =N+1. For each 1≤n≤k, the n-th subsequence is formed by taking the i n -th through (i n+1 −1)-th elements of A, maintaining their order. Here are some examples of divisions for A=(1,2,3,4,5):
(1,2,3),(4),(5) (1,2),(3,4,5) (1,2,3,4,5) Constraints 1≤N≤2×10 5
−10 15 ≤K≤10 15
−10 9 ≤A i ≤10 9
All input values are integers.
- Assistant