結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー ikomaikoma
提出日時 2022-10-14 21:53:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 626 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 76,168 KB
最終ジャッジ日時 2023-09-08 20:56:19
合計ジャッジ時間 8,285 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
75,856 KB
testcase_01 AC 75 ms
75,780 KB
testcase_02 AC 75 ms
75,828 KB
testcase_03 AC 78 ms
75,908 KB
testcase_04 AC 74 ms
75,684 KB
testcase_05 AC 76 ms
75,828 KB
testcase_06 AC 75 ms
75,820 KB
testcase_07 AC 76 ms
75,820 KB
testcase_08 AC 76 ms
75,692 KB
testcase_09 AC 76 ms
75,824 KB
testcase_10 AC 74 ms
75,788 KB
testcase_11 AC 74 ms
75,740 KB
testcase_12 AC 74 ms
75,744 KB
testcase_13 AC 79 ms
76,072 KB
testcase_14 AC 75 ms
75,732 KB
testcase_15 AC 76 ms
75,828 KB
testcase_16 AC 75 ms
75,804 KB
testcase_17 AC 75 ms
75,880 KB
testcase_18 AC 75 ms
75,844 KB
testcase_19 AC 75 ms
75,632 KB
testcase_20 AC 74 ms
75,904 KB
testcase_21 AC 74 ms
75,980 KB
testcase_22 AC 76 ms
75,836 KB
testcase_23 AC 74 ms
75,924 KB
testcase_24 AC 75 ms
75,760 KB
testcase_25 AC 76 ms
75,832 KB
testcase_26 AC 76 ms
75,780 KB
testcase_27 AC 75 ms
75,668 KB
testcase_28 AC 81 ms
75,836 KB
testcase_29 AC 76 ms
75,912 KB
testcase_30 AC 77 ms
75,664 KB
testcase_31 AC 77 ms
75,800 KB
testcase_32 AC 76 ms
75,652 KB
testcase_33 AC 81 ms
75,996 KB
testcase_34 AC 75 ms
75,704 KB
testcase_35 AC 75 ms
75,668 KB
testcase_36 AC 77 ms
75,648 KB
testcase_37 AC 76 ms
75,884 KB
testcase_38 AC 75 ms
75,772 KB
testcase_39 AC 76 ms
75,792 KB
testcase_40 AC 75 ms
75,884 KB
testcase_41 AC 75 ms
75,848 KB
testcase_42 AC 76 ms
75,832 KB
testcase_43 AC 75 ms
75,540 KB
testcase_44 AC 75 ms
75,928 KB
testcase_45 AC 77 ms
75,916 KB
testcase_46 AC 74 ms
75,696 KB
testcase_47 AC 75 ms
75,692 KB
testcase_48 AC 79 ms
75,912 KB
testcase_49 AC 78 ms
75,852 KB
testcase_50 AC 75 ms
75,632 KB
testcase_51 AC 76 ms
75,844 KB
testcase_52 AC 74 ms
75,824 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 76 ms
75,756 KB
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 AC 74 ms
75,820 KB
testcase_65 AC 76 ms
75,536 KB
testcase_66 AC 78 ms
75,536 KB
testcase_67 AC 79 ms
75,932 KB
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 AC 76 ms
75,820 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+10000<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
for i in range(low,high+1):
    t = solve(i)
    ans = min(ans, t)
print(ans)
0