結果

問題 No.1947 質より種類数
ユーザー siganaisiganai
提出日時 2022-05-20 22:44:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 441 ms / 2,000 ms
コード長 537 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 81,644 KB
実行使用メモリ 73,812 KB
最終ジャッジ日時 2023-10-20 13:32:42
合計ジャッジ時間 6,357 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
63,492 KB
testcase_01 AC 57 ms
63,492 KB
testcase_02 AC 56 ms
63,492 KB
testcase_03 AC 56 ms
63,492 KB
testcase_04 AC 73 ms
70,708 KB
testcase_05 AC 69 ms
70,724 KB
testcase_06 AC 74 ms
72,792 KB
testcase_07 AC 73 ms
70,720 KB
testcase_08 AC 73 ms
70,716 KB
testcase_09 AC 80 ms
70,716 KB
testcase_10 AC 77 ms
70,716 KB
testcase_11 AC 97 ms
73,068 KB
testcase_12 AC 83 ms
70,728 KB
testcase_13 AC 77 ms
70,724 KB
testcase_14 AC 184 ms
73,064 KB
testcase_15 AC 128 ms
73,064 KB
testcase_16 AC 231 ms
73,064 KB
testcase_17 AC 174 ms
73,064 KB
testcase_18 AC 441 ms
73,812 KB
testcase_19 AC 297 ms
73,504 KB
testcase_20 AC 191 ms
73,224 KB
testcase_21 AC 356 ms
73,468 KB
testcase_22 AC 82 ms
70,860 KB
testcase_23 AC 173 ms
73,064 KB
testcase_24 AC 72 ms
70,716 KB
testcase_25 AC 70 ms
70,712 KB
testcase_26 AC 72 ms
70,712 KB
testcase_27 AC 70 ms
70,712 KB
testcase_28 AC 72 ms
70,748 KB
testcase_29 AC 347 ms
73,048 KB
testcase_30 AC 322 ms
73,048 KB
testcase_31 AC 56 ms
63,508 KB
testcase_32 AC 56 ms
63,508 KB
testcase_33 AC 65 ms
68,644 KB
testcase_34 AC 76 ms
73,020 KB
testcase_35 AC 66 ms
70,884 KB
testcase_36 AC 309 ms
73,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env PyPy3

from collections import Counter, defaultdict, deque
import itertools
import re
import math
from functools import reduce
import operator
import bisect
from heapq import *
import functools
mod=998244353

import sys
input=sys.stdin.readline
n,V,c=map(int,input().split())
INF = 1 << 31
dp = [-INF] * (V+1)
dp[0] = 0
for i in range(n):
    v,w=map(int,input().split())
    for j in range(v,V+1):
        dp[j] = max(dp[j],dp[j-v]+w)
    for j in range(v,V+1)[::-1]:
        dp[j] = max(dp[j],dp[j-v]+w+c)
print(max(dp))
0