結果
| 問題 |
No.1072 A Nice XOR Pair
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-06 21:47:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 207 ms / 2,000 ms |
| コード長 | 452 bytes |
| コンパイル時間 | 258 ms |
| コンパイル使用メモリ | 82,204 KB |
| 実行使用メモリ | 89,060 KB |
| 最終ジャッジ日時 | 2024-07-20 17:05:16 |
| 合計ジャッジ時間 | 3,169 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
n, x = map(int, input().split())
a = []
for _ in range(n):
a.append(int(input()))
a = sorted(a)
b = sorted([i ^ x for i in a])
i = j = c = 0
while i < n and j < n:
if a[i] < b[j]:
i += 1
elif a[i] > b[j]:
j += 1
else:
i0 = i
while i < n and a[i] == a[i0]:
i += 1
j0 = j
while j < n and b[j] == b[j0]:
j += 1
c += (i - i0) * (j - j0 - (x == 0))
print(c // 2)