結果
問題 |
No.1072 A Nice XOR Pair
|
ユーザー |
![]() |
提出日時 | 2020-06-07 16:34:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 412 bytes |
コンパイル時間 | 1,397 ms |
コンパイル使用メモリ | 172,632 KB |
実行使用メモリ | 19,840 KB |
最終ジャッジ日時 | 2024-12-23 17:44:28 |
合計ジャッジ時間 | 2,921 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 8 WA * 3 |
ソースコード
#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; }