結果
| 問題 | No.1072 A Nice XOR Pair | 
| コンテスト | |
| ユーザー | 👑 | 
| 提出日時 | 2021-11-27 08:42:36 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 180 ms / 2,000 ms | 
| コード長 | 354 bytes | 
| コンパイル時間 | 588 ms | 
| コンパイル使用メモリ | 78,284 KB | 
| 実行使用メモリ | 24,192 KB | 
| 最終ジャッジ日時 | 2024-06-30 01:04:41 | 
| 合計ジャッジ時間 | 1,924 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 11 | 
ソースコード
#include <iostream>
#include <map>
using namespace std;
int main(){
  map<int,long long> A;
  int n,x;cin>>n>>x;
  for(int i = 0; n > i; i++){
    int t;cin>>t;
    A[t]++;
  }
  long long ans = 0;
  for(auto z: A){
    if(x==0){
      ans += (z.second*(z.second-1));
    }else{
      ans += z.second*A[z.first^x];
    }
  }
  cout << ans/2LL << endl;
}
            
            
            
        