結果
| 問題 |
No.1072 A Nice XOR Pair
|
| ユーザー |
東前頭十一枚目
|
| 提出日時 | 2020-06-07 16:36:19 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 191 ms / 2,000 ms |
| コード長 | 412 bytes |
| コンパイル時間 | 1,575 ms |
| コンパイル使用メモリ | 173,964 KB |
| 実行使用メモリ | 19,840 KB |
| 最終ジャッジ日時 | 2024-12-23 17:44:54 |
| 合計ジャッジ時間 | 3,022 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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> mp;
for(int i = 0; i < n; ++i) {
int a; cin >> a;
++mp[a];
}
int64_t ans = 0;
for(auto& e : mp) {
int nxt = e.first ^ x;
if(nxt < e.first) continue;
if(nxt == e.first) {
ans += e.second * (e.second - 1) / 2;
} else {
ans += e.second * mp[nxt];
}
}
cout << ans << '\n';
return 0;
}
東前頭十一枚目