結果

問題 No.723 2つの数の和
ユーザー brthyyjp
提出日時 2020-03-30 04:07:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 281 bytes
コンパイル時間 471 ms
コンパイル使用メモリ 82,720 KB
実行使用メモリ 96,768 KB
最終ジャッジ日時 2025-01-02 16:21:37
合計ジャッジ時間 3,351 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x = map(int, input().split())
A = list(map(int, input().split()))
d = {}
ans = 0
for a in A:
    if a not in d:
        d[a] = 1
    else:
        d[a] += 1
    if x-a in d:
        if a != x-a:
            ans += 2*d[x-a]
        else:
            ans += 2*d[x-a]-1
print(ans)
0