結果

問題 No.54 Happy Hallowe'en
ユーザー Ricky_ponRicky_pon
提出日時 2020-05-22 10:04:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 453 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 78,064 KB
最終ジャッジ日時 2024-04-14 22:04:18
合計ジャッジ時間 11,952 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
59,904 KB
testcase_01 AC 43 ms
59,300 KB
testcase_02 AC 43 ms
59,360 KB
testcase_03 AC 42 ms
59,532 KB
testcase_04 AC 504 ms
75,484 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 41 ms
58,804 KB
testcase_11 AC 40 ms
58,244 KB
testcase_12 AC 1,392 ms
77,856 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 42 ms
58,752 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

n = int(readline())
p = sorted([list(map(int, readline().split())) for _ in range(n)], key=lambda x: sum(x))
dp = [-1 for _ in range(10010)]
dp[0] = 0
ans = 0
for i in range(n):
    for j in range(10010):
        if 0 <= j - p[i][0] < p[i][1] and dp[j-p[i][0]] >= 0:
            dp[j] = max(dp[j], dp[j-p[i][0]] + 1)
            ans = max(ans, j)
print(ans)
0