結果

問題 No.3681 心の沸騰石
コンテスト
ユーザー 回転
提出日時 2026-09-05 14:48:38
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 55 ms / 2,000 ms
+ 299µs
コード長 428 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 226 ms
コンパイル使用メモリ 96,336 KB
実行使用メモリ 78,996 KB
最終ジャッジ日時 2026-09-05 14:48:41
合計ジャッジ時間 2,674 ms
ジャッジサーバーID
(参考情報)
judge7_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

R,P,Q = list(map(int,input().split()))
A,B,C,D = list(map(int,input().split()))

def check(n):
    cost = P * n
    free = sum([max(A-n,0), max(B-n,0), max(C-n,0), D])
    need = sum([max(n-A,0), max(n-B,0), max(n-C,0)])
    if(free < need):return False
    cost += need * Q
    return cost <= R

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