at3107

pehla

May 11th, 2021
507
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int n,m;
  7.     cin>>n>>m;
  8.     int arr[n];
  9.     unordered_map<int,int> M;
  10.     for(int i=0;i<n;i++)
  11.     {
  12.         cin>>arr[i];
  13.         M[arr[i]]++;
  14.     }
  15.     bool ans=0;
  16.     for(int i=0;i<n;i++)
  17.     {
  18.         if(m=2*arr[i] && M[arr[i]]>1) ans=1;
  19.         else if(M[m-arr[i]]) ans=1;
  20.     }
  21.     cout<<ans;
  22. }
RAW Paste Data