結果

問題 No.1072 A Nice XOR Pair
ユーザー 🍮かんプリン
提出日時 2020-06-05 21:52:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 255 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 1,376 ms
コンパイル使用メモリ 168,732 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-12-17 14:23:15
合計ジャッジ時間 2,996 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.06.05 21:52:07
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    int n,x;cin >> n >> x;
    map<int,int> mp;
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        int a;cin >> a;
        if (mp.find(x ^ a) != mp.end()) {
            ans += mp[x ^ a];
        }
        mp[a]++;
    }
    cout << ans << endl;
    return 0;
}
0