結果
| 問題 | 
                            No.54 Happy Hallowe'en
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-01-01 14:47:20 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 319 bytes | 
| コンパイル時間 | 162 ms | 
| コンパイル使用メモリ | 81,932 KB | 
| 実行使用メモリ | 77,612 KB | 
| 最終ジャッジ日時 | 2024-10-10 04:46:03 | 
| 合計ジャッジ時間 | 1,967 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 15 WA * 4 | 
ソースコード
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
            break
ans = 0
for i in range(2*10**4+5):
    if dp[i]:
        ans = i
print(ans)