結果

問題 No.2701 A cans -> B cans
ユーザー hirayuu_yc
提出日時 2024-02-18 09:40:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 427 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 81,964 KB
実行使用メモリ 68,624 KB
最終ジャッジ日時 2024-09-29 12:49:51
合計ジャッジ時間 5,906 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 6
other WA * 73
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#sys.setrecursionlimit((1<<19)-1)
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')
input=sys.stdin.buffer.readline

N,M=map(int,input().split())
can=[tuple(map(int,input().split())) for i in range(N)]
ans=0
while True:
    now=(0,0)
    for a,b,c in can:
        if M>=a:
            now=max(now,(((M-a)//(a-b)+1)*c*b,(M-a)%(a-b)))
    if now[0]==0:
        break
    ans+=now[0]
    M=now[1]
print(ans)
0