結果

問題 No.1072 A Nice XOR Pair
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2020-06-05 21:52:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 1,365 ms
コンパイル使用メモリ 152,808 KB
実行使用メモリ 12,692 KB
最終ジャッジ日時 2023-08-22 15:10:02
合計ジャッジ時間 2,833 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 207 ms
12,692 KB
testcase_08 AC 76 ms
4,380 KB
testcase_09 AC 76 ms
4,376 KB
testcase_10 AC 110 ms
4,376 KB
testcase_11 AC 151 ms
7,612 KB
testcase_12 AC 198 ms
12,124 KB
権限があれば一括ダウンロードができます

ソースコード

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