結果

問題 No.54 Happy Hallowe'en
ユーザー しらっ亭しらっ亭
提出日時 2015-11-12 23:27:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 464 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 9,364 KB
最終ジャッジ日時 2023-10-11 15:45:42
合計ジャッジ時間 16,574 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,320 KB
testcase_01 AC 17 ms
8,312 KB
testcase_02 AC 17 ms
8,336 KB
testcase_03 AC 16 ms
8,352 KB
testcase_04 AC 1,765 ms
8,740 KB
testcase_05 AC 3,103 ms
8,940 KB
testcase_06 AC 4,675 ms
9,364 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N = int(input())

    H = [None] * N

    for i in range(N):
        v, t = map(int, input().split())
        H[i] = (v, t)

    H.sort(key=lambda x: x[0] + x[1])

    dp = [False] * 20001
    dp[0] = True

    ma = 0
    for i in range(N):
        v, t = H[i]
        for j in range(t - 1, -1, -1):
            if dp[j]:
                dp[j + v] = True
                ma = max(ma, j + v)

    print(ma)


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