結果

問題 No.723 2つの数の和
ユーザー ryusukeryusuke
提出日時 2022-01-27 01:44:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 236 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 92,564 KB
最終ジャッジ日時 2023-08-25 15:35:08
合計ジャッジ時間 4,531 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,300 KB
testcase_01 AC 71 ms
71,528 KB
testcase_02 AC 69 ms
71,136 KB
testcase_03 AC 129 ms
86,992 KB
testcase_04 AC 165 ms
91,676 KB
testcase_05 AC 151 ms
89,588 KB
testcase_06 AC 149 ms
90,224 KB
testcase_07 AC 108 ms
81,512 KB
testcase_08 AC 110 ms
82,356 KB
testcase_09 AC 133 ms
92,564 KB
testcase_10 AC 125 ms
81,596 KB
testcase_11 AC 92 ms
77,404 KB
testcase_12 AC 111 ms
84,020 KB
testcase_13 AC 140 ms
91,840 KB
testcase_14 AC 94 ms
79,116 KB
testcase_15 AC 105 ms
82,332 KB
testcase_16 AC 118 ms
85,036 KB
testcase_17 AC 130 ms
89,888 KB
testcase_18 AC 121 ms
90,440 KB
testcase_19 AC 126 ms
91,836 KB
testcase_20 AC 69 ms
71,340 KB
testcase_21 AC 71 ms
71,476 KB
testcase_22 AC 69 ms
71,648 KB
testcase_23 AC 161 ms
91,740 KB
testcase_24 AC 109 ms
79,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left, bisect_right

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

ans = 0
for i in a:
    if x - i >= 0:
        ans += bisect_right(a, x - i) - bisect_left(a, x - i)

print(ans)
0