結果
| 問題 | No.1072 A Nice XOR Pair |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-09 08:36:47 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 225 ms / 2,000 ms |
| コード長 | 313 bytes |
| 記録 | |
| コンパイル時間 | 217 ms |
| コンパイル使用メモリ | 95,344 KB |
| 実行使用メモリ | 89,176 KB |
| 最終ジャッジ日時 | 2026-07-09 08:37:02 |
| 合計ジャッジ時間 | 3,163 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 |
ソースコード
from bisect import bisect_left,bisect_right
N,X = map(int,input().split())
A = sorted([int(input()) for _ in range(N)])
ans = 0
for i in range(N):
a = A[i]^X
ind1 = bisect_left(A,a)
ind2 = bisect_right(A,a)
if X==0:
ans += ind2 - ind1 - 1
else:
ans += ind2 - ind1
print(ans//2)