結果
| 問題 |
No.1072 A Nice XOR Pair
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2020-06-05 22:51:08 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 353 ms / 2,000 ms |
| コード長 | 718 bytes |
| コンパイル時間 | 2,907 ms |
| コンパイル使用メモリ | 228,536 KB |
| 最終ジャッジ日時 | 2025-01-10 22:51:07 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#include <bits/stdc++.h>
using namespace std;
int main(){
ll n,x;
cin>>n>>x;
ll a;
map<ll,ll> m;
rep(i,n){
cin>>a;
m[a]++;
}
if(x==0){
ll sum=0;
for(auto y:m){
sum+=y.second*(y.second-1)/2;
}
cout<<sum<<endl;
}
else{
ll sum=0;
for(auto y:m){
sum+=y.second*m[y.first^x];
m[y.first^x]=0;
}
cout<<sum<<endl;
}
return 0;
}
umezo