結果

問題 No.723 2つの数の和
ユーザー ryusukeryusuke
提出日時 2022-01-27 01:45:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 177 ms / 2,000 ms
コード長 213 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 87,324 KB
実行使用メモリ 92,316 KB
最終ジャッジ日時 2023-08-25 15:36:28
合計ジャッジ時間 5,129 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,468 KB
testcase_01 AC 83 ms
71,340 KB
testcase_02 AC 78 ms
71,376 KB
testcase_03 AC 143 ms
86,912 KB
testcase_04 AC 177 ms
91,888 KB
testcase_05 AC 156 ms
89,732 KB
testcase_06 AC 177 ms
90,348 KB
testcase_07 AC 124 ms
81,532 KB
testcase_08 AC 129 ms
82,260 KB
testcase_09 AC 155 ms
92,316 KB
testcase_10 AC 129 ms
81,660 KB
testcase_11 AC 97 ms
77,344 KB
testcase_12 AC 137 ms
83,760 KB
testcase_13 AC 150 ms
91,852 KB
testcase_14 AC 103 ms
78,928 KB
testcase_15 AC 112 ms
82,100 KB
testcase_16 AC 124 ms
85,020 KB
testcase_17 AC 141 ms
89,668 KB
testcase_18 AC 129 ms
90,256 KB
testcase_19 AC 133 ms
91,784 KB
testcase_20 AC 76 ms
71,364 KB
testcase_21 AC 73 ms
71,532 KB
testcase_22 AC 75 ms
71,532 KB
testcase_23 AC 165 ms
91,580 KB
testcase_24 AC 114 ms
80,096 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:
    ans += bisect_right(a, x - i) - bisect_left(a, x - i)

print(ans)
0