karlangadas

Arpa’s obvious problem and Mehrdad’s terrible solution

Dec 6th, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3. #include <cstring>
  4. using namespace std;
  5. long long m[100001];
  6.  
  7. int main() {
  8.     int n,x,r,aux;
  9.     long long ans=0;
  10.    
  11.     //map<long long,long long>m;
  12.    
  13.     cin>>n>>x;
  14.     memset(m,0,sizeof(m));
  15.     while(n--){
  16.         cin>>r;
  17.         aux=r^x;
  18.         ans=ans+m[aux];
  19.         m[r]++;
  20.     }
  21.     cout<<ans<<endl;
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment