結果

問題 No.54 Happy Hallowe'en
ユーザー 👑 rin204rin204
提出日時 2022-09-29 19:06:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 611 ms / 5,000 ms
コード長 329 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 78,552 KB
最終ジャッジ日時 2023-08-24 05:01:01
合計ジャッジ時間 5,455 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,448 KB
testcase_01 AC 71 ms
71,212 KB
testcase_02 AC 71 ms
71,208 KB
testcase_03 AC 74 ms
71,528 KB
testcase_04 AC 172 ms
77,928 KB
testcase_05 AC 226 ms
78,552 KB
testcase_06 AC 284 ms
78,048 KB
testcase_07 AC 383 ms
78,412 KB
testcase_08 AC 383 ms
78,024 KB
testcase_09 AC 611 ms
78,048 KB
testcase_10 AC 71 ms
71,576 KB
testcase_11 AC 74 ms
75,880 KB
testcase_12 AC 412 ms
78,256 KB
testcase_13 AC 520 ms
78,184 KB
testcase_14 AC 74 ms
75,516 KB
testcase_15 AC 71 ms
71,484 KB
testcase_16 AC 77 ms
76,076 KB
testcase_17 AC 78 ms
76,052 KB
testcase_18 AC 75 ms
75,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
vt = [list(map(int, input().split())) for _ in range(n)]
vt.sort(key=lambda x:x[0]+x[1])

dp = [False] * 10001
dp[0] = True
ans = 0
for v, t in vt:
    for i in range(t - 1, -1, -1):
        if dp[i]:
            ans = max(ans, i + v)
            if i + v <= 10000:
                dp[i + v] = True

print(ans)

0