結果
問題 |
No.1072 A Nice XOR Pair
|
ユーザー |
|
提出日時 | 2022-06-04 17:14:35 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 812 ms / 2,000 ms |
コード長 | 380 bytes |
コンパイル時間 | 92 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 65,156 KB |
最終ジャッジ日時 | 2024-09-21 03:47:54 |
合計ジャッジ時間 | 5,410 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
ソースコード
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)