結果
問題 |
No.1072 A Nice XOR Pair
|
ユーザー |
![]() |
提出日時 | 2025-03-20 21:05:18 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 222 ms / 2,000 ms |
コード長 | 351 bytes |
コンパイル時間 | 151 ms |
コンパイル使用メモリ | 82,972 KB |
実行使用メモリ | 94,360 KB |
最終ジャッジ日時 | 2025-03-20 21:05:25 |
合計ジャッジ時間 | 2,207 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
ソースコード
from collections import defaultdict n, x = map(int, input().split()) freq = defaultdict(int) for _ in range(n): a = int(input()) freq[a] += 1 ans = 0 if x == 0: for count in freq.values(): ans += count * (count - 1) // 2 else: for a in freq: b = a ^ x ans += freq[a] * freq.get(b, 0) ans //= 2 print(ans)