Advertisement
at3107

pehla

May 11th, 2021
578
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement