結果

問題 No.723 2つの数の和
ユーザー FukumotoFukumoto
提出日時 2020-06-08 23:03:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 189 ms / 2,000 ms
コード長 217 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 10,504 KB
実行使用メモリ 19,688 KB
最終ジャッジ日時 2023-08-27 06:36:46
合計ジャッジ時間 3,912 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,788 KB
testcase_01 AC 15 ms
8,012 KB
testcase_02 AC 15 ms
7,964 KB
testcase_03 AC 138 ms
15,680 KB
testcase_04 AC 189 ms
18,888 KB
testcase_05 AC 162 ms
17,684 KB
testcase_06 AC 169 ms
17,932 KB
testcase_07 AC 80 ms
12,484 KB
testcase_08 AC 91 ms
13,228 KB
testcase_09 AC 174 ms
19,080 KB
testcase_10 AC 77 ms
12,340 KB
testcase_11 AC 27 ms
9,076 KB
testcase_12 AC 100 ms
14,084 KB
testcase_13 AC 186 ms
19,688 KB
testcase_14 AC 50 ms
10,692 KB
testcase_15 AC 80 ms
12,684 KB
testcase_16 AC 119 ms
14,940 KB
testcase_17 AC 156 ms
17,332 KB
testcase_18 AC 142 ms
10,036 KB
testcase_19 AC 163 ms
19,672 KB
testcase_20 AC 16 ms
7,920 KB
testcase_21 AC 16 ms
7,896 KB
testcase_22 AC 15 ms
7,836 KB
testcase_23 AC 170 ms
19,672 KB
testcase_24 AC 59 ms
11,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *

N, X = list(map(int, input().split()))
A = list(map(int, input().split()))
ans = 0

A = sorted(A)
for a in A:
    l = bisect_left(A, X-a)
    r = bisect_right(A, X-a)
 
    ans += r-l
print(ans)
0