結果
| 問題 | No.1072 A Nice XOR Pair |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-06 21:47:40 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 153 ms / 2,000 ms |
| コード長 | 452 bytes |
| 記録 | |
| コンパイル時間 | 485 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 182,912 KB |
| 最終ジャッジ日時 | 2026-04-03 01:39:58 |
| 合計ジャッジ時間 | 1,922 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)