結果

問題 No.54 Happy Hallowe'en
ユーザー szkhtsszkhts
提出日時 2023-11-26 08:06:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 438 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 18,324 KB
最終ジャッジ日時 2023-11-26 08:06:29
合計ジャッジ時間 15,654 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,240 KB
testcase_01 AC 31 ms
10,240 KB
testcase_02 AC 30 ms
10,240 KB
testcase_03 AC 30 ms
10,240 KB
testcase_04 AC 1,607 ms
10,880 KB
testcase_05 AC 2,754 ms
11,008 KB
testcase_06 AC 4,082 ms
11,392 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 #

n = int(input())
vt = []
MAX = 25000
dp = [False] * MAX

for _ in range(n):
    v, t = map(int, input().split())
    vt.append([(v + t), t])
    
vt.sort()

V = []
T = []
for i in range(n):
    V.append(vt[i][0] - vt[i][1])
    T.append(vt[i][1])
    
dp[0] = True
for i in range(n):
    for j in range(T[i] - 1, -1, -1):
        dp[j + V[i]] |= dp[j]
        
for i in range(MAX - 1, -1, -1):
    if dp[i]:
        print(i)
        break
0