CF577B.Modulo Sum

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given a sequence of numbers a1,a2,...,ana_{1},a_{2},...,a_{n} , and a number mm .

Check if it is possible to choose a non-empty subsequence aija_{ij} such that the sum of numbers in this subsequence is divisible by mm .

输入格式

The first line contains two numbers, nn and mm ( 1<=n<=1061<=n<=10^{6} , 2<=m<=1032<=m<=10^{3} ) — the size of the original sequence and the number such that sum should be divisible by it.

The second line contains nn integers a1,a2,...,ana_{1},a_{2},...,a_{n} ( 0<=ai<=1090<=a_{i}<=10^{9} ).

输出格式

In the single line print either "YES" (without the quotes) if there exists the sought subsequence, or "NO" (without the quotes), if such subsequence doesn't exist.

输入输出样例

  • 输入#1

    3 5
    1 2 3
    

    输出#1

    YES
    
  • 输入#2

    1 6
    5
    

    输出#2

    NO
    
  • 输入#3

    4 6
    3 1 1 3
    

    输出#3

    YES
    
  • 输入#4

    6 6
    5 5 5 5 5 5
    

    输出#4

    YES
    

说明/提示

In the first sample test you can choose numbers 22 and 33 , the sum of which is divisible by 55 .

In the second sample test the single non-empty subsequence of numbers is a single number 55 . Number 55 is not divisible by 66 , that is, the sought subsequence doesn't exist.

In the third sample test you need to choose two numbers 33 on the ends.

In the fourth sample test you can take the whole subsequence.

首页