結果

問題 No.2701 A cans -> B cans
ユーザー mkawa2mkawa2
提出日時 2024-03-29 22:51:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,037 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 76,676 KB
最終ジャッジ日時 2024-03-29 22:52:32
合計ジャッジ時間 27,618 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 52 ms
64,440 KB
testcase_04 AC 73 ms
64,440 KB
testcase_05 AC 51 ms
64,440 KB
testcase_06 AC 52 ms
64,440 KB
testcase_07 AC 52 ms
64,440 KB
testcase_08 AC 54 ms
64,440 KB
testcase_09 AC 52 ms
64,440 KB
testcase_10 AC 51 ms
64,440 KB
testcase_11 AC 52 ms
64,440 KB
testcase_12 AC 52 ms
64,440 KB
testcase_13 AC 52 ms
64,440 KB
testcase_14 AC 53 ms
64,440 KB
testcase_15 AC 52 ms
64,440 KB
testcase_16 AC 52 ms
64,440 KB
testcase_17 AC 53 ms
64,440 KB
testcase_18 AC 52 ms
64,440 KB
testcase_19 AC 52 ms
64,440 KB
testcase_20 AC 52 ms
64,440 KB
testcase_21 AC 65 ms
64,440 KB
testcase_22 AC 52 ms
64,440 KB
testcase_23 AC 70 ms
74,320 KB
testcase_24 AC 72 ms
74,320 KB
testcase_25 AC 77 ms
76,628 KB
testcase_26 AC 371 ms
76,400 KB
testcase_27 AC 376 ms
76,396 KB
testcase_28 AC 399 ms
76,400 KB
testcase_29 AC 377 ms
76,396 KB
testcase_30 AC 372 ms
76,400 KB
testcase_31 AC 399 ms
76,400 KB
testcase_32 AC 441 ms
76,424 KB
testcase_33 AC 376 ms
76,396 KB
testcase_34 AC 445 ms
76,424 KB
testcase_35 AC 369 ms
76,396 KB
testcase_36 AC 372 ms
76,400 KB
testcase_37 AC 378 ms
76,524 KB
testcase_38 AC 374 ms
76,400 KB
testcase_39 WA -
testcase_40 AC 374 ms
76,400 KB
testcase_41 AC 362 ms
76,528 KB
testcase_42 WA -
testcase_43 AC 380 ms
76,396 KB
testcase_44 AC 374 ms
76,396 KB
testcase_45 AC 371 ms
76,400 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 TLE -
testcase_67 TLE -
testcase_68 TLE -
testcase_69 TLE -
testcase_70 TLE -
testcase_71 TLE -
testcase_72 TLE -
testcase_73 TLE -
testcase_74 TLE -
testcase_75 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(1000005)
# 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-(-1 << 31)
inf = -1-(-1 << 62)

# md = 10**9+7
md = 998244353

n,m=LI()
abc=LLI(n)
abc.sort(key=lambda x:-x[0])
dp=[0]*(m+1)
now=[]
for p in range(1,m+1):
    while abc and abc[-1][0]<=p:now.append(abc.pop())
    ans=0
    for a,b,c in now:
        cur=((p-a)//(a-b)+1)*b*c+dp[(p-a)%(a-b)]
        if cur>ans:ans=cur
    print(ans)
0