結果
| 問題 |
No.1072 A Nice XOR Pair
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-10 16:33:32 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 621 ms / 2,000 ms |
| コード長 | 328 bytes |
| コンパイル時間 | 140 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 34,096 KB |
| 最終ジャッジ日時 | 2024-06-23 07:40:03 |
| 合計ジャッジ時間 | 4,209 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
from collections import Counter
n, x = map(int, input().split())
A = [int(input()) for _ in range(n)]
c = Counter(A)
res = 0
if x == 0:
for k,v in c.items():
res += v * (v - 1) // 2
print(res)
else:
for k, v in c.items():
if k ^ x in c.keys():
res += c[k] * c[k ^ x]
print(res // 2)