DIVISIBLE SEQUENCE

View as PDF



Time limit:
Scratch 10.0s
Memory limit:
Scratch 500M

Problem type
Points: 200 (p) Time limit: 1.0s Memory limit: 256M Input: stdin Output: stdout

Cho dãy gồm \(n\) số nguyên dương và một số nguyên \(K\). Bạn hãy giúp Tèo tìm ra đoạn con dài nhất gồm các phần tử liên tiếp sao cho tổng các phần tử này chia hết cho \(K\).

Input

  • Dòng \(1\)\(N\)\(K\) \((1 \le n, k \le 10^5)\)
  • Dòng thứ \(2\) chứa dãy số \(n\) phần tử \((0 \le A_i \le 10^9)\)

Output

  • Là độ dài lớn nhất tìm được.

Example

Test 1

Input
9 4
3 9 9 5 1 1 10 3 5
Output
6

Comments

There are no comments at the moment.