結果
| 問題 | No.1072 A Nice XOR Pair |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-04 17:14:35 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 400 ms / 2,000 ms |
| + 972µs | |
| コード長 | 380 bytes |
| 記録 | |
| コンパイル時間 | 54 ms |
| コンパイル使用メモリ | 14,848 KB |
| 実行使用メモリ | 65,352 KB |
| 最終ジャッジ日時 | 2026-10-12 20:39:39 |
| 合計ジャッジ時間 | 3,408 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 |
ソースコード
from collections import Counter
n, x = map(int, input().split())
A = [int(input()) for _ in range(n)]
counter = Counter(A)
seen = set()
ans = 0
for val, cnt in counter.items():
if val in seen:
continue
res = x ^ val
if res == val:
ans += cnt * (cnt - 1) // 2
else:
ans += cnt * counter[res]
seen.add(val)
seen.add(res)
print(ans)