結果

問題 No.3065 Speedrun (Normal)
ユーザー 回転
提出日時 2025-05-22 01:49:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 477 bytes
コンパイル時間 511 ms
コンパイル使用メモリ 82,404 KB
実行使用メモリ 53,536 KB
最終ジャッジ日時 2025-05-22 01:49:52
合計ジャッジ時間 2,131 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B,C,D = list(map(int,input().split()))
P,Q,R,S,T = list(map(int,input().split()))
a = [(A,P),(B,Q),(C,R),(D,S)]
a.sort(key=lambda x:x[1])

def check(n):
    now = 0
    time = 0
    for i in range(4):
        solve = min(a[i][0],n - now)
        now += solve
        time += solve * a[i][1]
    return time <= T

ok,ng = 0,10**18+1
while(ng - ok > 1):
    mid = (ok+ng)//2
    if(check(mid)):
        ok = mid
    else:
        ng = mid
print(ok if ok != 10**18 else A+B+C+D)
0