#ABC473E. K 倍子数组 / K-Divisible Subarrays
K 倍子数组 / K-Divisible Subarrays
Problem Statement
You are given a sequence of length consisting of non-negative integers: .
Define the score of a sequence of length or more consisting of sequences of non-negative integers, , as the number of sequences whose sum of elements is divisible by .
Find the maximum possible score of a sequence of non-negative integer sequences obtained by dividing into one or more contiguous subsequences. Here, dividing a sequence of length into one or more contiguous subsequences means choosing a sequence of integers $l=(l _ 1,l _ 2,\ldots,l _ k)\ (1=l _ 1\lt l _ 2\lt\cdots\lt l _ k\le N)$ of length or more, and forming the following sequences.
- $(A _ {l _ i},A _ {l _ i+1},\ldots,A _ {l _ {i+1}-1})\ (1\le i\le k)$ (Here, let .)
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Output the answer.
6 10
6 8 2 2 6 4
2
For example, can be divided into four contiguous subsequences as . The sums of the elements of the second and fourth sequences are multiples of , so the score of is .
cannot be divided so that the score is or more, so output 2.
8 1
0 0 0 0 0 0 0 0
8
30 8
5 0 4 2 7 3 2 3 2 4 0 1 4 0 4 1 7 5 2 5 0 3 6 6 2 3 2 2 4 2
8
- Source: AtCoder ABC 473 E
相关
在下列比赛中: