Created
April 16, 2023 21:00
-
-
Save estelabn/3f5bff19cf6f772956f4a808fe65d88d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int main(){ | |
int n, x; | |
cin >> n >> x; | |
vector<int> a(n); | |
set<int> s; | |
for(int i=0; i<n; i++){ | |
cin >> a[i]; | |
s.insert(a[i]); | |
} | |
bool res = false; | |
for(int i=0; i<n; i++){ | |
int outro = a[i] - x; | |
if(s.find(outro) != s.end()) res = true; | |
} | |
if(res) cout << "Yes" << endl; | |
else cout << "No" << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment