結果
問題 | No.1072 A Nice XOR Pair |
ユーザー |
![]() |
提出日時 | 2020-06-19 22:57:23 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 661 ms / 2,000 ms |
コード長 | 251 bytes |
コンパイル時間 | 104 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 34,180 KB |
最終ジャッジ日時 | 2024-07-03 15:24:26 |
合計ジャッジ時間 | 4,581 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
ソースコード
n,x=map(int,input().split()) a=[int(input()) for _ in range(n)] from collections import Counter c=Counter(a) ans=0 if x==0: for v in c.values(): ans+=v*(v-1)//2 print(ans) else: for k in c.keys(): b=k^x ans+=c[b]*c[k] print(ans//2)