結果
| 問題 |
No.1072 A Nice XOR Pair
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-01 20:05:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 211 ms / 2,000 ms |
| コード長 | 289 bytes |
| コンパイル時間 | 475 ms |
| コンパイル使用メモリ | 81,852 KB |
| 実行使用メモリ | 126,276 KB |
| 最終ジャッジ日時 | 2024-11-14 11:22:08 |
| 合計ジャッジ時間 | 2,917 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
from collections import defaultdict
n,x = map(int,input().split())
a = [int(input()) for i in range(n)]
d = defaultdict(int)
for i in range(n):
d[a[i]] += 1
ans = 0
for i in range(n):
if a[i]^x == a[i]:
ans += d[a[i]^x]-1
else:
ans += d[a[i]^x]
print(ans//2)