結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー ikomaikoma
提出日時 2022-10-14 22:00:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 616 bytes
コンパイル時間 883 ms
コンパイル使用メモリ 86,788 KB
実行使用メモリ 75,824 KB
最終ジャッジ日時 2023-09-08 21:16:24
合計ジャッジ時間 9,329 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
75,424 KB
testcase_01 AC 80 ms
75,372 KB
testcase_02 AC 80 ms
75,664 KB
testcase_03 AC 77 ms
75,684 KB
testcase_04 AC 79 ms
75,564 KB
testcase_05 AC 81 ms
75,604 KB
testcase_06 AC 80 ms
75,652 KB
testcase_07 AC 77 ms
75,528 KB
testcase_08 AC 80 ms
75,596 KB
testcase_09 AC 78 ms
75,644 KB
testcase_10 AC 79 ms
75,596 KB
testcase_11 AC 79 ms
75,820 KB
testcase_12 AC 80 ms
75,816 KB
testcase_13 AC 77 ms
75,436 KB
testcase_14 AC 80 ms
75,756 KB
testcase_15 AC 82 ms
75,780 KB
testcase_16 AC 79 ms
75,752 KB
testcase_17 AC 76 ms
75,628 KB
testcase_18 AC 81 ms
75,512 KB
testcase_19 AC 80 ms
75,424 KB
testcase_20 AC 80 ms
75,512 KB
testcase_21 AC 80 ms
75,600 KB
testcase_22 AC 79 ms
75,632 KB
testcase_23 AC 80 ms
75,608 KB
testcase_24 AC 85 ms
75,348 KB
testcase_25 AC 80 ms
75,668 KB
testcase_26 AC 84 ms
75,620 KB
testcase_27 AC 83 ms
75,644 KB
testcase_28 AC 82 ms
75,432 KB
testcase_29 AC 84 ms
75,532 KB
testcase_30 AC 85 ms
75,652 KB
testcase_31 AC 85 ms
75,748 KB
testcase_32 AC 81 ms
75,532 KB
testcase_33 AC 82 ms
75,716 KB
testcase_34 AC 84 ms
75,536 KB
testcase_35 AC 82 ms
75,820 KB
testcase_36 AC 80 ms
75,372 KB
testcase_37 AC 78 ms
75,560 KB
testcase_38 AC 80 ms
75,780 KB
testcase_39 AC 81 ms
75,824 KB
testcase_40 AC 80 ms
75,584 KB
testcase_41 AC 80 ms
75,624 KB
testcase_42 AC 80 ms
75,696 KB
testcase_43 AC 80 ms
75,692 KB
testcase_44 AC 80 ms
75,420 KB
testcase_45 AC 80 ms
75,752 KB
testcase_46 AC 79 ms
75,596 KB
testcase_47 AC 80 ms
75,600 KB
testcase_48 AC 77 ms
75,684 KB
testcase_49 AC 80 ms
75,552 KB
testcase_50 AC 80 ms
75,632 KB
testcase_51 AC 84 ms
75,476 KB
testcase_52 AC 76 ms
75,348 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 AC 77 ms
75,592 KB
testcase_57 AC 79 ms
75,756 KB
testcase_58 AC 81 ms
75,560 KB
testcase_59 AC 83 ms
75,628 KB
testcase_60 AC 84 ms
75,560 KB
testcase_61 AC 84 ms
75,416 KB
testcase_62 AC 84 ms
75,500 KB
testcase_63 AC 80 ms
75,380 KB
testcase_64 AC 79 ms
75,596 KB
testcase_65 AC 78 ms
75,596 KB
testcase_66 AC 80 ms
75,596 KB
testcase_67 AC 78 ms
75,624 KB
testcase_68 AC 80 ms
75,776 KB
testcase_69 AC 79 ms
75,800 KB
testcase_70 AC 80 ms
75,376 KB
testcase_71 AC 80 ms
75,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def calc(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 = calc(c1)
    t2 = calc(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(10**6):
    t = calc(i)
    ans = min(ans, t)

print(ans)

0