結果

問題 No.723 2つの数の和
ユーザー yurarayurara
提出日時 2019-05-15 23:54:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 333 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 10,712 KB
実行使用メモリ 19,588 KB
最終ジャッジ日時 2023-10-12 18:52:44
合計ジャッジ時間 6,752 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
15,100 KB
testcase_01 AC 16 ms
7,936 KB
testcase_02 AC 16 ms
7,892 KB
testcase_03 AC 125 ms
15,668 KB
testcase_04 AC 171 ms
19,516 KB
testcase_05 AC 141 ms
17,920 KB
testcase_06 AC 165 ms
17,796 KB
testcase_07 AC 72 ms
12,328 KB
testcase_08 AC 83 ms
13,244 KB
testcase_09 AC 164 ms
19,036 KB
testcase_10 AC 71 ms
12,288 KB
testcase_11 AC 27 ms
9,068 KB
testcase_12 AC 92 ms
14,024 KB
testcase_13 AC 144 ms
19,588 KB
testcase_14 AC 43 ms
10,876 KB
testcase_15 AC 64 ms
12,732 KB
testcase_16 AC 94 ms
14,964 KB
testcase_17 AC 119 ms
17,416 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

N, X = map(int, input().split())
As = list(map(int, input().split()))

As.sort()

count = 0
for a in As:
    idx = bisect.bisect_left(As, X - a)
    loop = 0
    while True:
        if idx + loop < N and As[idx + loop] == X - a:
            count += 1
            loop += 1
        else:
            break
print(count)
0