結果

問題 No.1072 A Nice XOR Pair
ユーザー iqueue02iqueue02
提出日時 2020-07-13 22:52:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 416 ms / 2,000 ms
コード長 476 bytes
コンパイル時間 2,534 ms
コンパイル使用メモリ 204,892 KB
実行使用メモリ 19,584 KB
最終ジャッジ日時 2024-04-26 04:06:45
合計ジャッジ時間 4,984 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 4 ms
6,940 KB
testcase_07 AC 313 ms
13,312 KB
testcase_08 AC 90 ms
6,940 KB
testcase_09 AC 90 ms
6,940 KB
testcase_10 AC 121 ms
6,944 KB
testcase_11 AC 241 ms
9,856 KB
testcase_12 AC 416 ms
19,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr int INF = 2e9;

int main() {
  int n, x;
  cin >> n >> x;
  map<int,int> mp;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  for (int i = 0; i < n; i++) {
    mp[a[i]]++;
  }
  ll res = 0;
  for (int i = 0; i < n; i++) {
    mp[a[i]]--;
    res += mp[a[i] ^ x];
  }
  cout << res << endl;
  return 0;
}
0