結果
| 問題 |
No.1072 A Nice XOR Pair
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2020-06-05 21:47:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 484 ms / 2,000 ms |
| コード長 | 375 bytes |
| コンパイル時間 | 2,192 ms |
| コンパイル使用メモリ | 201,540 KB |
| 最終ジャッジ日時 | 2025-01-10 22:26:29 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x;
cin >> n >> x;
map<int, int64_t> a, b;
for (int i = 0; i < n; i++) {
int k;
cin >> k;
a[k]++;
b[k ^ x]++;
}
int64_t ans = 0;
for (auto x : a) {
ans += x.second * b[x.first];
}
if (x == 0) ans -= n;
cout << ans / 2 << endl;
}
trineutron