結果

問題 No.723 2つの数の和
ユーザー s_shohei
提出日時 2020-04-16 22:55:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 262 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 90,240 KB
最終ジャッジ日時 2024-10-02 14:44:42
合計ジャッジ時間 3,811 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()

import bisect
ans=0
for i in range(n):
    now=a[i]
    nokori = x-now
    ind1 = bisect.bisect_left(a,nokori)
    ind2 = bisect.bisect_right(a,nokori)
    ans+=(ind2-ind1)

print(ans)
0