結果

問題 No.1072 A Nice XOR Pair
ユーザー CleyLCleyL
提出日時 2021-11-27 08:42:11
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 346 bytes
コンパイル時間 646 ms
コンパイル使用メモリ 77,064 KB
実行使用メモリ 19,032 KB
最終ジャッジ日時 2023-09-12 12:41:36
合計ジャッジ時間 3,185 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 223 ms
12,732 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 87 ms
4,380 KB
testcase_11 AC 137 ms
9,084 KB
testcase_12 AC 240 ms
19,032 KB
権限があれば一括ダウンロードができます

ソースコード

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