#P11128. 【MX-X5-T0】「GFOI Round 1」Hypnotize

【MX-X5-T0】「GFOI Round 1」Hypnotize

Background

Original link: https://oier.team/problems/X5A.


$\small\text{The absolute catastrophe of \textbf{I\&“Ī྄”} .}$

Problem Description

There are nn charts in Arcaea. The difficulty of the ii-th chart is a positive integer aia_i.

You are given a positive integer kk, and you want to play two charts whose difficulty difference is exactly kk.

You need to determine whether there exist two charts that satisfy the requirement. If yes, output Yes; otherwise, output No.

Input Format

The first line contains two positive integers n,kn, k.

The second line contains nn positive integers a1,a2,,ana_1, a_2, \ldots, a_n.

Output Format

If there exist two charts that satisfy the requirement, output Yes; otherwise, output No.

10 4
1 3 2 4 3 5 4 6 5 7
Yes
10 11
1 3 2 4 3 5 4 6 5 7
No

Hint

Sample Explanation #1

In the first sample, choose the 11-st and the 66-th charts. Since a6a1=4a_6 - a_1 = 4, output Yes.

Sample Explanation #2

In the second sample, there are no two charts with difficulty difference 1111, so output No.

Constraints

This problem contains 2020 test points, and each test point has the same score.

For all testdata, 1n1001 \le n \le 100, 1k,ai1091 \le k, a_i \le 10^9.

Translated by ChatGPT 5