結果

問題 No.1947 質より種類数
ユーザー siganaisiganai
提出日時 2022-05-20 22:35:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 742 bytes
コンパイル時間 1,185 ms
コンパイル使用メモリ 81,728 KB
実行使用メモリ 91,276 KB
最終ジャッジ日時 2023-10-20 13:21:05
合計ジャッジ時間 7,636 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
63,636 KB
testcase_01 AC 57 ms
63,588 KB
testcase_02 AC 56 ms
63,588 KB
testcase_03 AC 58 ms
63,588 KB
testcase_04 AC 118 ms
78,140 KB
testcase_05 AC 93 ms
73,424 KB
testcase_06 AC 113 ms
77,892 KB
testcase_07 AC 101 ms
74,492 KB
testcase_08 AC 126 ms
78,108 KB
testcase_09 AC 739 ms
81,416 KB
testcase_10 AC 396 ms
79,992 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

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) for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
    v,w=map(int,input().split())
    for j in range(1,i+2)[::-1]:
        for k in range(min(v,V+1)):
            tmp = dp[j-1][k]
            for x in range(k+v,V+1,v):
                tmp = max(tmp+w,dp[j-1][x-v]+w)
                dp[j][x] = max(tmp,dp[j][x])
ans = 0
for i in range(n+1):
    for j in range(V+1):
        ans = max(ans,i*c+dp[i][j])
print(ans)
0