結果
| 問題 | No.1072 A Nice XOR Pair |
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 21:05:18 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 158 ms / 2,000 ms |
| + 621µs | |
| コード長 | 351 bytes |
| 記録 | |
| コンパイル時間 | 73 ms |
| コンパイル使用メモリ | 81,024 KB |
| 実行使用メモリ | 100,584 KB |
| 最終ジャッジ日時 | 2026-10-12 21:00:55 |
| 合計ジャッジ時間 | 2,188 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 |
ソースコード
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)
lam6er