結果

問題 No.1072 A Nice XOR Pair
ユーザー yuly3yuly3
提出日時 2020-06-26 10:55:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 425 bytes
コンパイル時間 1,522 ms
コンパイル使用メモリ 86,852 KB
実行使用メモリ 156,616 KB
最終ジャッジ日時 2023-09-16 23:36:11
合計ジャッジ時間 4,307 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
71,384 KB
testcase_01 AC 85 ms
71,416 KB
testcase_02 AC 83 ms
71,480 KB
testcase_03 AC 84 ms
71,404 KB
testcase_04 WA -
testcase_05 AC 83 ms
71,264 KB
testcase_06 AC 93 ms
77,392 KB
testcase_07 AC 268 ms
141,788 KB
testcase_08 AC 143 ms
79,144 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 215 ms
110,676 KB
testcase_12 AC 268 ms
156,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import Counter, defaultdict

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, X = map(int, rl().split())
    A = [int(rl()) for _ in range(N)]
    
    counter = Counter(A)
    used = defaultdict(int)
    ans = 0
    for ai in A:
        tgt = X ^ ai
        ans += counter[tgt] - used[tgt]
        used[ai] += 1
    print(ans)


if __name__ == '__main__':
    solve()
0