[SOLUTION] Summing the values SOLUTION CODECHEF
Problem SOLUTION CODECHEF For an array �B of length �M, we define its value �(�)f(B) as follows: �(�)=∑�=1�−1((∑�=1���)−(∑�=�+1���))f(B)=i=1∑M−1((j=1∑iBj)−(j=i+1∑MBj)) In particular, if �=1M=1 then �(�)=0f(B)=0. You’re given an array �A of length �N. Find the sum of values of all of its subarrays. That is, compute ∑�=1�∑�=���(�[�…�])L=1∑NR=L∑Nf(A[L…R]) where �[�…�]A[L…R] denotes the subarray [��,��+1,��+2,…,��][AL,AL+1,AL+2,…,AR]. The answer can be large, so print it modulo 998244353998244353. Input Format The first line of input will contain a single … Read more