結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー ikomaikoma
提出日時 2022-10-14 21:50:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 554 bytes
コンパイル時間 1,419 ms
コンパイル使用メモリ 86,620 KB
実行使用メモリ 71,508 KB
最終ジャッジ日時 2023-09-08 20:52:31
合計ジャッジ時間 7,958 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,184 KB
testcase_01 AC 70 ms
70,964 KB
testcase_02 AC 73 ms
71,116 KB
testcase_03 AC 71 ms
71,132 KB
testcase_04 AC 71 ms
71,184 KB
testcase_05 AC 72 ms
71,204 KB
testcase_06 AC 71 ms
71,284 KB
testcase_07 AC 72 ms
71,112 KB
testcase_08 AC 72 ms
70,924 KB
testcase_09 AC 72 ms
71,252 KB
testcase_10 AC 73 ms
71,120 KB
testcase_11 AC 70 ms
71,124 KB
testcase_12 AC 73 ms
71,048 KB
testcase_13 AC 72 ms
71,288 KB
testcase_14 AC 72 ms
71,196 KB
testcase_15 AC 71 ms
71,164 KB
testcase_16 AC 72 ms
71,276 KB
testcase_17 AC 70 ms
71,128 KB
testcase_18 AC 70 ms
71,208 KB
testcase_19 AC 70 ms
71,364 KB
testcase_20 AC 72 ms
71,064 KB
testcase_21 AC 72 ms
71,276 KB
testcase_22 AC 71 ms
71,148 KB
testcase_23 AC 71 ms
70,920 KB
testcase_24 AC 71 ms
71,076 KB
testcase_25 AC 72 ms
71,108 KB
testcase_26 AC 73 ms
71,212 KB
testcase_27 AC 72 ms
71,048 KB
testcase_28 AC 70 ms
71,080 KB
testcase_29 AC 71 ms
71,060 KB
testcase_30 AC 71 ms
71,104 KB
testcase_31 AC 70 ms
71,112 KB
testcase_32 AC 70 ms
71,076 KB
testcase_33 AC 72 ms
71,208 KB
testcase_34 AC 70 ms
71,196 KB
testcase_35 AC 72 ms
71,168 KB
testcase_36 AC 72 ms
71,280 KB
testcase_37 AC 72 ms
71,232 KB
testcase_38 AC 73 ms
71,296 KB
testcase_39 AC 72 ms
71,276 KB
testcase_40 AC 72 ms
71,128 KB
testcase_41 AC 73 ms
71,248 KB
testcase_42 AC 72 ms
71,056 KB
testcase_43 AC 71 ms
71,100 KB
testcase_44 AC 72 ms
71,296 KB
testcase_45 AC 72 ms
70,940 KB
testcase_46 AC 72 ms
71,108 KB
testcase_47 AC 71 ms
71,112 KB
testcase_48 AC 72 ms
71,128 KB
testcase_49 AC 72 ms
71,104 KB
testcase_50 AC 71 ms
71,168 KB
testcase_51 AC 73 ms
71,232 KB
testcase_52 AC 72 ms
70,964 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 73 ms
71,196 KB
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 AC 74 ms
71,196 KB
testcase_65 AC 72 ms
71,380 KB
testcase_66 AC 72 ms
71,188 KB
testcase_67 AC 72 ms
71,124 KB
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 AC 72 ms
71,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
X,A=map(int,input().split())
Y,B=map(int,input().split())

def solve(na:int):
    x = A*na
    t=X*na
    if x <= T:
        return (T-x) + t
    d = x-T
    nb = (d+B-1)//B
    t += Y*nb
    x -= B*nb
    return t + (T-x)

low = 0
high = 10**7
ans = 10**9

while low<high:
    c1 = (low*2+high)//3
    c2 = (low+high*2)//3

    t1 = solve(c1)
    t2 = solve(c2)

    if t1<t2:
        if high==c2:break
        high = c2
        ans = min(ans, t1)
    else:
        if low==c1:break
        ans = min(ans, t2)
        low = c1
print(ans)
0