結果

問題 No.2093 Shio Ramen
ユーザー AkariAkari
提出日時 2022-10-07 21:37:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 10,776 KB
実行使用メモリ 29,868 KB
最終ジャッジ日時 2023-09-03 00:46:59
合計ジャッジ時間 7,402 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
29,648 KB
testcase_01 AC 139 ms
29,700 KB
testcase_02 AC 142 ms
29,740 KB
testcase_03 AC 138 ms
29,664 KB
testcase_04 AC 140 ms
29,668 KB
testcase_05 AC 140 ms
29,700 KB
testcase_06 AC 134 ms
29,708 KB
testcase_07 AC 134 ms
29,668 KB
testcase_08 AC 142 ms
29,728 KB
testcase_09 AC 142 ms
29,728 KB
testcase_10 AC 142 ms
29,748 KB
testcase_11 AC 140 ms
29,668 KB
testcase_12 AC 140 ms
29,836 KB
testcase_13 AC 143 ms
29,692 KB
testcase_14 AC 139 ms
29,708 KB
testcase_15 AC 140 ms
29,720 KB
testcase_16 AC 139 ms
29,672 KB
testcase_17 AC 140 ms
29,760 KB
testcase_18 AC 139 ms
29,732 KB
testcase_19 AC 137 ms
29,816 KB
testcase_20 AC 136 ms
29,732 KB
testcase_21 AC 142 ms
29,844 KB
testcase_22 AC 142 ms
29,868 KB
testcase_23 AC 142 ms
29,768 KB
testcase_24 AC 142 ms
29,760 KB
testcase_25 AC 143 ms
29,692 KB
testcase_26 AC 142 ms
29,688 KB
testcase_27 AC 147 ms
29,696 KB
testcase_28 AC 144 ms
29,708 KB
testcase_29 AC 143 ms
29,740 KB
testcase_30 AC 143 ms
29,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import numpy as np


def main():
    n, x = map(int, input().split())
    S, A = np.fromstring(sys.stdin.read(), np.int64, sep=' ').reshape(-1, 2).T
    dp = np.zeros(x + 1, np.int64)
    for i in range(n):
        s, a = S[i], A[i]
        np.maximum(dp[s:], dp[:-s] + a, dp[s:])
    print(dp.max())



if __name__ == '__main__':
    main()
0