Skip to content

Instantly share code, notes, and snippets.

@estelabn
Created April 16, 2023 21:00
Show Gist options
  • Save estelabn/3f5bff19cf6f772956f4a808fe65d88d to your computer and use it in GitHub Desktop.
Save estelabn/3f5bff19cf6f772956f4a808fe65d88d to your computer and use it in GitHub Desktop.
#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