結果

問題 No.1072 A Nice XOR Pair
ユーザー QDSNQDSN
提出日時 2020-06-06 22:15:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 485 bytes
コンパイル時間 1,602 ms
コンパイル使用メモリ 175,872 KB
実行使用メモリ 25,220 KB
最終ジャッジ日時 2023-08-25 02:05:21
合計ジャッジ時間 3,583 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 302 ms
17,104 KB
testcase_08 AC 80 ms
4,632 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 194 ms
12,220 KB
testcase_12 AC 338 ms
25,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0