結果
問題 |
No.1072 A Nice XOR Pair
|
ユーザー |
|
提出日時 | 2020-06-06 22:15:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 485 bytes |
コンパイル時間 | 1,778 ms |
コンパイル使用メモリ | 177,068 KB |
実行使用メモリ | 25,472 KB |
最終ジャッジ日時 | 2024-12-23 14:07:18 |
合計ジャッジ時間 | 3,139 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 8 WA * 3 |
ソースコード
#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, unq = 0; for(int i = 0; i < n; i++) { if(a[i] == (a[i] ^ x)) { unq++; } ans += mp[a[i] ^ x]; } cout << ans / 2 - unq << endl; }