結果

問題 No.54 Happy Hallowe'en
ユーザー H3PO4H3PO4
提出日時 2023-02-19 14:26:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 318 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 10,600 KB
実行使用メモリ 31,204 KB
最終ジャッジ日時 2023-09-27 20:32:18
合計ジャッジ時間 7,215 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
29,496 KB
testcase_01 AC 110 ms
29,400 KB
testcase_02 AC 113 ms
29,440 KB
testcase_03 AC 113 ms
29,464 KB
testcase_04 AC 128 ms
29,924 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 115 ms
29,524 KB
testcase_11 RE -
testcase_12 AC 162 ms
30,792 KB
testcase_13 RE -
testcase_14 AC 113 ms
29,528 KB
testcase_15 AC 114 ms
29,448 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N = int(input())
MAX = 10000

homes = [tuple(map(int, input().split())) for _ in range(N)]
homes.sort(key=lambda x: x[0] + x[1])

dp = np.zeros(MAX + 1, dtype=bool)
dp[0] = True
for v, t in homes:
    new_dp = dp.copy()
    new_dp[v:v + t] |= dp[:t]
    dp = new_dp

print(np.nonzero(dp)[0].max())
0