結果

問題 No.1072 A Nice XOR Pair
ユーザー 👑 CleyL
提出日時 2021-11-27 08:42:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 346 bytes
コンパイル時間 616 ms
コンパイル使用メモリ 78,400 KB
実行使用メモリ 18,944 KB
最終ジャッジ日時 2024-06-30 01:04:27
合計ジャッジ時間 2,206 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;

int main(){
  map<int,int> 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/2 << endl;
}
0