CF687B.Remainders Game

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Today Pari and Arya are playing a game called Remainders.

Pari chooses two positive integer x and k, and tells Arya k but not x. Arya have to find the value . There are n ancient numbers _c_1, _c_2, ..., c__n and Pari has to tell Arya if Arya wants. Given k and the ancient values, tell us if Arya has a winning strategy independent of value of x or not. Formally, is it true that Arya can understand the value for any positive integer x?

Note, that means the remainder of x after dividing it by y.

今天,帕丽(Pari)和阿莉亚(Arya)正在玩一个名为“余数”的游戏。

帕丽选择两个正整数 xx 和 kk,并将 kk 告知阿莉亚,但不告诉 xx。阿莉亚需要求出值 x mod k\displaystyle x \bmod k。此外,存在 nn 个古老数字 c1, c2, …, cnc_1,\,c_2,\,\dots,\,c_n,若阿莉亚要求,帕丽需告知她 x mod ci\displaystyle x \bmod c_i(对任意 ii)。已知 kk 及这些古老数值,请判断:阿莉亚是否存在一种与 xx 的具体取值无关的必胜策略?换言之,对于任意正整数 xx,阿莉亚是否总能确定 x mod k\displaystyle x \bmod k 的值?

注意:x mod y\displaystyle x \bmod y 表示 xx 除以 yy 后所得的余数。

输入格式

The first line of the input contains two integers n and k (1 ≤ n,  k ≤ 1 000 000) — the number of ancient integers and value k that is chosen by Pari.

The second line contains n integers _c_1, _c_2, ..., c__n (1 ≤ c__i ≤ 1 000 000).

输入的第一行包含两个整数 nn 和 kk(1≤n,k≤1 000 0001 \leq n, k \leq 1\,000\,000)—— 分别表示古代整数的个数以及 Pari 所选定的值 kk。

第二行包含 nn 个整数 c1,c2,…,cnc_1, c_2, \dots, c_n(1≤ci≤1 000 0001 \leq c_i \leq 1\,000\,000)。

输出格式

Print "Yes" (without quotes) if Arya has a winning strategy independent of value of x, or "No" (without quotes) otherwise.

如果阿雅拥有一个与 xx 的值无关的必胜策略,则输出“Yes”(不带引号);否则输出“No”(不带引号)。

输入输出样例

  • 输入#1

    4 5
    2 3 5 12

    输出#1

    Yes
  • 输入#2

    2 7
    2 3

    输出#2

    No

说明/提示

In the first sample, Arya can understand because 5 is one of the ancient numbers.

In the second sample, Arya can't be sure what is. For example 1 and 7 have the same remainders after dividing by 2 and 3, but they differ in remainders after dividing by 7.

在第一个样例中,Arya 能够理解 ,因为 55 是某个古老数字。

在第二个样例中,Arya 无法确定 的值。例如,11 和 77 在分别除以 22 和 33 后具有相同的余数,但它们在除以 77 后的余数不同。

输入解题思路,AI测评打分。不知道怎么写?

首页