結果

問題 No.1072 A Nice XOR Pair
ユーザー k-ish0212
提出日時 2020-06-05 22:39:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 327 bytes
コンパイル時間 656 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 41,448 KB
最終ジャッジ日時 2024-12-17 16:39:39
合計ジャッジ時間 5,096 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x = map(int, input().split())
a = [int(input()) for _ in range(n)]
# print(a)
a.sort()
ans = 0
d = {}
for i in a:
    tmp = str(i)
    if tmp not in d:
        d[tmp] = 1
    else:
        d[tmp] += 1
# print(d)
for i in d:
    tmp = str(int(i) ^ x)
    if tmp in d:
        ans += d[i] * d[tmp]
        d[tmp] = 0
print(ans)
0