結果
問題 | No.1072 A Nice XOR Pair |
ユーザー |
![]() |
提出日時 | 2020-06-05 21:32:23 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 283 ms / 2,000 ms |
コード長 | 348 bytes |
コンパイル時間 | 90 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 34,044 KB |
最終ジャッジ日時 | 2024-12-17 13:33:32 |
合計ジャッジ時間 | 2,038 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
ソースコード
from collections import Counterimport sysinput = sys.stdin.readlinen, x = map(int, input().split())a = [int(input()) for _ in range(n)]c = Counter(a)ans = 0if x == 0:for k, v in c.items():ans += (v * (v - 1) // 2)else:for k, v in c.items():if k ^ x in c:ans += v * c[k ^ x]ans //= 2print(ans)