結果

問題 No.54 Happy Hallowe'en
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-01-01 14:48:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 415 ms / 5,000 ms
コード長 302 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 82,104 KB
実行使用メモリ 77,676 KB
最終ジャッジ日時 2024-04-18 11:36:22
合計ジャッジ時間 3,226 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
57,600 KB
testcase_01 AC 38 ms
57,600 KB
testcase_02 AC 37 ms
57,600 KB
testcase_03 AC 38 ms
57,728 KB
testcase_04 AC 116 ms
74,624 KB
testcase_05 AC 155 ms
76,928 KB
testcase_06 AC 198 ms
77,260 KB
testcase_07 AC 264 ms
77,676 KB
testcase_08 AC 234 ms
77,312 KB
testcase_09 AC 415 ms
77,568 KB
testcase_10 AC 39 ms
57,600 KB
testcase_11 AC 40 ms
58,368 KB
testcase_12 AC 264 ms
77,312 KB
testcase_13 AC 278 ms
77,436 KB
testcase_14 AC 39 ms
58,368 KB
testcase_15 AC 38 ms
57,600 KB
testcase_16 AC 40 ms
59,516 KB
testcase_17 AC 41 ms
58,752 KB
testcase_18 AC 41 ms
58,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = [0]*(2*10**4+5)
dp[0] = 1
for v,t in VT:
    for i in range(t)[::-1]:
        if dp[i]:
            dp[i+v] = 1


ans = 0
for i in range(2*10**4+5):
    if dp[i]:
        ans = i
print(ans)
0