結果

問題 No.1072 A Nice XOR Pair
ユーザー FromBooskaFromBooska
提出日時 2023-10-18 12:38:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 417 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,764 KB
実行使用メモリ 111,728 KB
最終ジャッジ日時 2023-10-18 12:38:09
合計ジャッジ時間 3,017 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,504 KB
testcase_01 AC 39 ms
53,504 KB
testcase_02 AC 42 ms
53,504 KB
testcase_03 AC 42 ms
53,504 KB
testcase_04 WA -
testcase_05 AC 40 ms
53,504 KB
testcase_06 AC 65 ms
70,984 KB
testcase_07 AC 241 ms
111,728 KB
testcase_08 AC 160 ms
81,444 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 190 ms
93,920 KB
testcase_12 AC 203 ms
109,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# Ai^Aj=Xということは、Ai=Aj^X
# Counter
# X==0 and or Ai==0のときは別対応必要なのか?

N, X = map(int, input().split())
A = []
for i in range(N):
    A.append(int(input()))
from collections import Counter
counted = Counter(A)

ans = 0
for i in range(N):
    xa = X^A[i]
    calc = counted[xa]
    ans += calc
ans //= 2 #双方から数えているのでダブルカウントしている
print(ans)
0