結果

問題 No.723 2つの数の和
ユーザー O2MTO2MT
提出日時 2020-08-21 17:59:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 235 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 20,876 KB
最終ジャッジ日時 2024-04-23 05:10:29
合計ジャッジ時間 3,180 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,880 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 AC 30 ms
10,880 KB
testcase_03 AC 130 ms
17,300 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 165 ms
19,108 KB
testcase_07 AC 80 ms
14,448 KB
testcase_08 AC 88 ms
15,116 KB
testcase_09 AC 161 ms
20,876 KB
testcase_10 RE -
testcase_11 AC 39 ms
11,648 KB
testcase_12 AC 97 ms
15,868 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 155 ms
12,624 KB
testcase_19 AC 189 ms
20,860 KB
testcase_20 AC 31 ms
10,880 KB
testcase_21 AC 30 ms
10,752 KB
testcase_22 AC 31 ms
10,880 KB
testcase_23 AC 195 ms
20,664 KB
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *
N,X = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
ans = 0
for i in range(N):
  b = bisect_left(A,X-A[i])
  if A[i]+A[b] == X:
    br = bisect_right(A,X-A[i])
    ans += (br-b)
print(ans)
  
0