結果

問題 No.1072 A Nice XOR Pair
ユーザー kbyskbys
提出日時 2020-06-22 21:42:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 537 ms / 2,000 ms
コード長 253 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 10,504 KB
実行使用メモリ 31,224 KB
最終ジャッジ日時 2023-09-16 19:28:08
合計ジャッジ時間 4,240 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,852 KB
testcase_01 AC 16 ms
7,784 KB
testcase_02 AC 16 ms
7,840 KB
testcase_03 AC 15 ms
7,856 KB
testcase_04 AC 16 ms
7,940 KB
testcase_05 AC 16 ms
7,952 KB
testcase_06 AC 21 ms
8,448 KB
testcase_07 AC 537 ms
31,212 KB
testcase_08 AC 529 ms
15,904 KB
testcase_09 AC 516 ms
15,880 KB
testcase_10 AC 523 ms
15,920 KB
testcase_11 AC 515 ms
19,652 KB
testcase_12 AC 501 ms
31,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, X = map(int,input().split())

A = [0]*N
for i in range(N):
    A[i] = int(input())
    
cnt = {}

ans = 0
for a in A:
    if a^X in cnt:
        ans += cnt[a^X]
    if a not in cnt:
        cnt[a] = 1
    else:
        cnt[a] += 1
        
print(ans)
0