結果
問題 |
No.723 2つの数の和
|
ユーザー |
👑 |
提出日時 | 2020-06-30 15:52:54 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 176 ms / 2,000 ms |
コード長 | 341 bytes |
コンパイル時間 | 269 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 20,856 KB |
最終ジャッジ日時 | 2024-07-23 19:03:43 |
合計ジャッジ時間 | 4,384 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
from bisect import bisect_right, bisect_left n, x = map(int, input().split()) alst = list(map(int, input().split())) alst.sort() ans = 0 for num in alst: tmp = x - num if num == tmp: ans += bisect_right(alst, tmp) - bisect_left(alst, tmp) else: ans += bisect_right(alst, tmp) - bisect_left(alst, tmp) print(ans)