結果

問題 No.2317 Expression Menu
ユーザー mkawa2mkawa2
提出日時 2023-05-26 21:42:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 461 ms / 2,000 ms
コード長 1,021 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 78,132 KB
最終ジャッジ日時 2023-08-26 10:56:29
合計ジャッジ時間 11,435 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,508 KB
testcase_01 AC 73 ms
71,260 KB
testcase_02 AC 90 ms
76,484 KB
testcase_03 AC 187 ms
76,700 KB
testcase_04 AC 186 ms
76,724 KB
testcase_05 AC 184 ms
76,772 KB
testcase_06 AC 189 ms
76,528 KB
testcase_07 AC 143 ms
77,036 KB
testcase_08 AC 191 ms
76,932 KB
testcase_09 AC 147 ms
76,852 KB
testcase_10 AC 201 ms
76,836 KB
testcase_11 AC 199 ms
76,828 KB
testcase_12 AC 154 ms
78,132 KB
testcase_13 AC 187 ms
76,656 KB
testcase_14 AC 205 ms
76,852 KB
testcase_15 AC 145 ms
76,844 KB
testcase_16 AC 188 ms
76,940 KB
testcase_17 AC 190 ms
76,524 KB
testcase_18 AC 226 ms
76,612 KB
testcase_19 AC 202 ms
76,868 KB
testcase_20 AC 205 ms
76,884 KB
testcase_21 AC 186 ms
76,868 KB
testcase_22 AC 150 ms
76,544 KB
testcase_23 AC 455 ms
76,604 KB
testcase_24 AC 461 ms
76,856 KB
testcase_25 AC 456 ms
76,864 KB
testcase_26 AC 453 ms
76,888 KB
testcase_27 AC 459 ms
76,792 KB
testcase_28 AC 458 ms
76,736 KB
testcase_29 AC 451 ms
76,520 KB
testcase_30 AC 455 ms
76,752 KB
testcase_31 AC 457 ms
76,888 KB
testcase_32 AC 453 ms
76,520 KB
testcase_33 AC 72 ms
71,444 KB
testcase_34 AC 74 ms
71,216 KB
testcase_35 AC 74 ms
71,388 KB
testcase_36 AC 71 ms
71,412 KB
testcase_37 AC 73 ms
71,384 KB
testcase_38 AC 446 ms
76,452 KB
testcase_39 AC 382 ms
76,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# md = 10**9+7
md = 998244353

n,x,y=LI()

def chmax(i,j,val):
    if val>dp[i][j]:dp[i][j]=val

dp=[[0]*(y+1) for _ in range(x+1)]
dp[0][0]=0
for _ in range(n):
    a,b,c=LI()
    for i in range(x-a,-1,-1):
        for j in range(y-b,-1,-1):
            chmax(i+a,j+b,dp[i][j]+c)
            
print(dp[x][y])
0