結果

問題 No.1072 A Nice XOR Pair
ユーザー roarisroaris
提出日時 2020-06-05 21:45:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 198 ms / 2,000 ms
コード長 274 bytes
コンパイル時間 1,307 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 110,636 KB
最終ジャッジ日時 2023-08-22 14:53:21
合計ジャッジ時間 4,009 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,196 KB
testcase_01 AC 92 ms
71,720 KB
testcase_02 AC 92 ms
71,604 KB
testcase_03 AC 93 ms
71,488 KB
testcase_04 AC 93 ms
71,420 KB
testcase_05 AC 93 ms
71,276 KB
testcase_06 AC 102 ms
77,512 KB
testcase_07 AC 198 ms
110,636 KB
testcase_08 AC 149 ms
79,360 KB
testcase_09 AC 148 ms
79,284 KB
testcase_10 AC 150 ms
79,320 KB
testcase_11 AC 169 ms
91,976 KB
testcase_12 AC 186 ms
107,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N, X = map(int, input().split())
A = [int(input()) for _ in range(N)]
cnt = Counter(A)
ans = 0

for i in range(N):
    pair = A[i]^X
    ans += cnt[pair]
    
    if A[i]==pair:
        ans -= 1

print(ans//2)
0