結果
問題 |
No.1072 A Nice XOR Pair
|
ユーザー |
|
提出日時 | 2020-06-06 22:16:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 264 ms / 2,000 ms |
コード長 | 470 bytes |
コンパイル時間 | 1,844 ms |
コンパイル使用メモリ | 176,468 KB |
実行使用メモリ | 25,472 KB |
最終ジャッジ日時 | 2024-12-23 14:07:26 |
合計ジャッジ時間 | 3,116 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
ソースコード
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() typedef long long ll; #define MOD 998244353 using namespace std; int main() { ll n, x; cin >> n >> x; map<ll, ll> mp; vector<ll> a(n); for(int i = 0; i < n; i++) { cin >> a[i]; mp[a[i]]++; } ll ans = 0; for(int i = 0; i < n; i++) { if(a[i] == (a[i] ^ x)) { ans--; } ans += mp[a[i] ^ x]; } cout << ans / 2 << endl; }