結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-10-14 22:48:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 76,048 KB
最終ジャッジ日時 2023-09-08 23:09:38
合計ジャッジ時間 11,404 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 198 ms
75,684 KB
testcase_01 AC 78 ms
75,912 KB
testcase_02 AC 91 ms
75,660 KB
testcase_03 AC 337 ms
75,828 KB
testcase_04 AC 225 ms
75,916 KB
testcase_05 AC 66 ms
71,248 KB
testcase_06 AC 67 ms
71,364 KB
testcase_07 AC 159 ms
75,764 KB
testcase_08 AC 96 ms
75,736 KB
testcase_09 AC 74 ms
75,908 KB
testcase_10 AC 87 ms
75,808 KB
testcase_11 AC 73 ms
75,712 KB
testcase_12 AC 74 ms
75,608 KB
testcase_13 AC 335 ms
75,892 KB
testcase_14 AC 227 ms
75,824 KB
testcase_15 AC 65 ms
71,300 KB
testcase_16 AC 67 ms
71,200 KB
testcase_17 AC 158 ms
76,012 KB
testcase_18 AC 78 ms
75,940 KB
testcase_19 AC 84 ms
75,708 KB
testcase_20 AC 100 ms
75,684 KB
testcase_21 AC 74 ms
75,796 KB
testcase_22 AC 72 ms
75,572 KB
testcase_23 AC 73 ms
75,608 KB
testcase_24 AC 82 ms
75,944 KB
testcase_25 AC 79 ms
75,740 KB
testcase_26 AC 72 ms
76,044 KB
testcase_27 AC 76 ms
75,736 KB
testcase_28 AC 337 ms
75,948 KB
testcase_29 AC 226 ms
75,952 KB
testcase_30 AC 66 ms
71,256 KB
testcase_31 AC 65 ms
71,348 KB
testcase_32 AC 158 ms
75,848 KB
testcase_33 AC 338 ms
75,732 KB
testcase_34 AC 225 ms
75,944 KB
testcase_35 AC 67 ms
71,548 KB
testcase_36 AC 66 ms
71,360 KB
testcase_37 AC 157 ms
75,868 KB
testcase_38 AC 75 ms
75,864 KB
testcase_39 AC 73 ms
75,976 KB
testcase_40 AC 74 ms
75,948 KB
testcase_41 AC 74 ms
75,744 KB
testcase_42 AC 78 ms
75,856 KB
testcase_43 AC 75 ms
75,652 KB
testcase_44 AC 75 ms
76,024 KB
testcase_45 AC 75 ms
76,044 KB
testcase_46 AC 74 ms
75,572 KB
testcase_47 AC 74 ms
75,780 KB
testcase_48 AC 335 ms
75,732 KB
testcase_49 AC 225 ms
75,740 KB
testcase_50 AC 65 ms
71,312 KB
testcase_51 AC 67 ms
71,548 KB
testcase_52 AC 159 ms
75,860 KB
testcase_53 AC 233 ms
75,900 KB
testcase_54 AC 165 ms
76,048 KB
testcase_55 AC 87 ms
75,812 KB
testcase_56 AC 66 ms
71,284 KB
testcase_57 AC 65 ms
71,316 KB
testcase_58 AC 65 ms
71,300 KB
testcase_59 AC 65 ms
71,444 KB
testcase_60 AC 67 ms
71,492 KB
testcase_61 AC 67 ms
71,064 KB
testcase_62 AC 67 ms
71,256 KB
testcase_63 AC 66 ms
71,516 KB
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
x,a = map(int,input().split())
y,b = map(int,input().split())
ans = 10 ** 15
if t >= 0:
    cnt = 0
    while cnt * a <= 3*10**7:
        p_ans = ans
        if cnt * a <= t:
            ans = min(ans,x*cnt + t-a * cnt)
        else:
            ans = min(ans,x*cnt + (-((-(a*cnt-t))//b)) * y +  t - (a*cnt - (-((-(a*cnt-t))//b)) * b))
        cnt += 1

cnt = 0 
b *= -1
while cnt * b >=  - 3*10**7:
    if cnt * b <= t:
        p_ans = ans
        ans = min(ans,y * cnt +  ((t - b*cnt)//a) * x + t - (cnt * b  + ((t - b*cnt)//a) * a))
    cnt += 1
print(ans)
0