結果

問題 No.1072 A Nice XOR Pair
ユーザー TsuboTsubo
提出日時 2020-06-12 20:51:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 31,740 KB
最終ジャッジ日時 2023-09-06 09:32:26
合計ジャッジ時間 2,181 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,480 KB
testcase_01 AC 19 ms
8,628 KB
testcase_02 AC 19 ms
8,624 KB
testcase_03 AC 19 ms
8,604 KB
testcase_04 WA -
testcase_05 AC 19 ms
8,512 KB
testcase_06 AC 21 ms
8,720 KB
testcase_07 AC 235 ms
31,740 KB
testcase_08 AC 103 ms
16,284 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 154 ms
20,092 KB
testcase_12 AC 200 ms
31,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
from collections import Counter
def main():
    #入力
    readline=stdin.readline
    n,x=map(int,readline().split())
    a=[int(readline()) for _ in range(n)]

    c=Counter(a)
    cnt=0
    if x==0:
        for v in c.values():
            cnt+=v*(v-1)
        print(cnt)
    else:
        for k in c.keys():
            b=k^x
            cnt+=c[b]*c[k]
        cnt//=2
        print(cnt)

if __name__=="__main__":
    main()
0