結果

問題 No.723 2つの数の和
ユーザー s_shoheis_shohei
提出日時 2020-04-16 22:55:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 262 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 82,756 KB
実行使用メモリ 90,400 KB
最終ジャッジ日時 2024-04-10 12:44:25
合計ジャッジ時間 3,430 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,260 KB
testcase_01 AC 37 ms
52,764 KB
testcase_02 AC 37 ms
52,548 KB
testcase_03 AC 124 ms
85,340 KB
testcase_04 AC 142 ms
89,852 KB
testcase_05 AC 128 ms
88,136 KB
testcase_06 AC 145 ms
88,288 KB
testcase_07 AC 86 ms
79,968 KB
testcase_08 AC 88 ms
80,724 KB
testcase_09 AC 122 ms
90,144 KB
testcase_10 AC 101 ms
79,952 KB
testcase_11 AC 67 ms
76,052 KB
testcase_12 AC 100 ms
82,460 KB
testcase_13 AC 116 ms
90,400 KB
testcase_14 AC 69 ms
77,500 KB
testcase_15 AC 78 ms
80,948 KB
testcase_16 AC 90 ms
83,524 KB
testcase_17 AC 105 ms
87,856 KB
testcase_18 AC 94 ms
88,252 KB
testcase_19 AC 98 ms
89,816 KB
testcase_20 AC 37 ms
52,344 KB
testcase_21 AC 37 ms
52,652 KB
testcase_22 AC 36 ms
53,192 KB
testcase_23 AC 130 ms
89,880 KB
testcase_24 AC 82 ms
78,836 KB
権限があれば一括ダウンロードができます

ソースコード

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