結果

問題 No.2317 Expression Menu
ユーザー cleanttedcleantted
提出日時 2023-02-19 01:44:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,645 ms / 2,000 ms
コード長 1,313 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 81,940 KB
実行使用メモリ 311,484 KB
最終ジャッジ日時 2023-10-18 13:21:07
合計ジャッジ時間 52,465 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
90,992 KB
testcase_01 AC 155 ms
90,984 KB
testcase_02 AC 259 ms
106,976 KB
testcase_03 AC 1,540 ms
311,472 KB
testcase_04 AC 1,508 ms
311,472 KB
testcase_05 AC 1,531 ms
311,480 KB
testcase_06 AC 1,516 ms
311,472 KB
testcase_07 AC 1,530 ms
311,472 KB
testcase_08 AC 1,527 ms
311,472 KB
testcase_09 AC 1,538 ms
311,484 KB
testcase_10 AC 1,535 ms
311,472 KB
testcase_11 AC 1,535 ms
311,472 KB
testcase_12 AC 1,536 ms
311,472 KB
testcase_13 AC 1,520 ms
311,420 KB
testcase_14 AC 1,550 ms
311,484 KB
testcase_15 AC 1,544 ms
311,472 KB
testcase_16 AC 1,555 ms
311,472 KB
testcase_17 AC 1,547 ms
311,472 KB
testcase_18 AC 1,512 ms
311,472 KB
testcase_19 AC 1,525 ms
311,472 KB
testcase_20 AC 1,531 ms
311,472 KB
testcase_21 AC 1,500 ms
311,484 KB
testcase_22 AC 1,495 ms
311,472 KB
testcase_23 AC 1,617 ms
311,472 KB
testcase_24 AC 1,621 ms
311,484 KB
testcase_25 AC 1,607 ms
311,472 KB
testcase_26 AC 1,606 ms
311,472 KB
testcase_27 AC 1,605 ms
311,472 KB
testcase_28 AC 1,606 ms
311,472 KB
testcase_29 AC 1,601 ms
311,468 KB
testcase_30 AC 1,645 ms
311,472 KB
testcase_31 AC 1,617 ms
311,484 KB
testcase_32 AC 1,618 ms
311,472 KB
testcase_33 AC 151 ms
91,000 KB
testcase_34 AC 151 ms
90,984 KB
testcase_35 AC 156 ms
91,876 KB
testcase_36 AC 156 ms
90,984 KB
testcase_37 AC 151 ms
90,984 KB
testcase_38 AC 1,133 ms
311,472 KB
testcase_39 AC 1,152 ms
311,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
from math import gcd, log10, pi, sqrt, ceil
from bisect import bisect, bisect_left, bisect_right, insort
from typing import Iterable, TypeVar, Union, Tuple, Iterator, List
import copy
import heapq
import itertools
import math
import random
from fractions import Fraction
from functools import lru_cache, partial, cmp_to_key
import operator
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
mod = 998244353
INF = 1 << 61
DIFF = 10 ** -9
DX = [1, 0, -1, 0, 1, 1, -1, -1]
DY = [0, 1, 0, -1, 1, -1, 1, -1]

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for _ in range(N)]


def main():
    N, X, Y = read_values()
    L = read_lists(N)
    dp = [[[0] * (Y + 1) for _ in range(X + 1)] for _ in range(N + 1)]

    for k, (a, b, c) in enumerate(L):
        for x in range(X + 1):
            for y in range(Y + 1):
                if x + a <= X and y + b <= Y:
                    dp[k + 1][x + a][y + b] = max(dp[k + 1][x + a][y + b], dp[k][x][y] + c)
                dp[k + 1][x][y] = max(dp[k + 1][x][y], dp[k][x][y])
    
    print(max(max(v) for v in dp[N]))


if __name__ == "__main__":
    main()
0