結果

問題 No.1072 A Nice XOR Pair
ユーザー mlihua09mlihua09
提出日時 2020-09-15 02:34:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 402 bytes
コンパイル時間 614 ms
コンパイル使用メモリ 70,960 KB
実行使用メモリ 12,772 KB
最終ジャッジ日時 2023-09-04 01:26:36
合計ジャッジ時間 4,893 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<set>

int main() {
    int N, X;
    std::cin >> N >> X;
    
    std::multiset<int> A;
    
    int ans = 0;
    
    if (X == 0) {
        ans -= N;
    }
    
    for (int i = 0; i < N; i++) {
        int a;
        std::cin >> a;
        A.insert(a);
    }
    
    
    for (auto a:A) {
        ans += A.count(a ^ X);
    }
    
    std::cout << ans / 2 << std::endl;
}
0