結果
| 問題 |
No.1072 A Nice XOR Pair
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-23 00:28:59 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 545 ms / 2,000 ms |
| コード長 | 448 bytes |
| コンパイル時間 | 1,792 ms |
| コンパイル使用メモリ | 180,240 KB |
| 実行使用メモリ | 45,568 KB |
| 最終ジャッジ日時 | 2024-07-03 19:03:32 |
| 合計ジャッジ時間 | 4,148 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
long n,x;
cin >> n >> x;
long ar[n];
for(int i=0;i<n;i++)cin >> ar[i];
map<long,long>a;
map<long,long>b;
set<long>s;
for(int i=0;i<n;i++){
a[ar[i]]++;
b[ar[i]^x]++;
s.insert(ar[i]);
}
long ans = 0;
for(long i: s){
if(x != 0)ans += a[i] * b[i];
else ans += a[i] * (b[i]-1);
}
cout << ans/2 << endl;
}