結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-10-14 22:24:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 589 bytes
コンパイル時間 558 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 75,792 KB
最終ジャッジ日時 2023-09-08 22:29:24
合計ジャッジ時間 10,082 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
75,372 KB
testcase_01 AC 80 ms
75,164 KB
testcase_02 AC 99 ms
75,472 KB
testcase_03 AC 154 ms
75,708 KB
testcase_04 AC 237 ms
75,396 KB
testcase_05 AC 72 ms
70,976 KB
testcase_06 AC 71 ms
71,228 KB
testcase_07 AC 163 ms
75,556 KB
testcase_08 AC 73 ms
71,096 KB
testcase_09 AC 74 ms
70,912 KB
testcase_10 AC 71 ms
71,284 KB
testcase_11 AC 72 ms
71,120 KB
testcase_12 AC 72 ms
70,972 KB
testcase_13 AC 154 ms
75,608 KB
testcase_14 AC 232 ms
75,512 KB
testcase_15 AC 72 ms
70,976 KB
testcase_16 AC 71 ms
70,872 KB
testcase_17 AC 165 ms
75,488 KB
testcase_18 AC 83 ms
75,588 KB
testcase_19 AC 85 ms
75,592 KB
testcase_20 AC 104 ms
75,516 KB
testcase_21 AC 80 ms
75,416 KB
testcase_22 AC 73 ms
71,176 KB
testcase_23 AC 72 ms
71,192 KB
testcase_24 AC 87 ms
75,520 KB
testcase_25 AC 86 ms
75,700 KB
testcase_26 AC 79 ms
75,744 KB
testcase_27 AC 70 ms
70,956 KB
testcase_28 AC 153 ms
75,492 KB
testcase_29 AC 231 ms
75,664 KB
testcase_30 AC 73 ms
71,148 KB
testcase_31 AC 75 ms
71,040 KB
testcase_32 AC 169 ms
75,752 KB
testcase_33 AC 158 ms
75,312 KB
testcase_34 AC 233 ms
75,668 KB
testcase_35 AC 72 ms
70,944 KB
testcase_36 AC 70 ms
71,268 KB
testcase_37 AC 168 ms
75,584 KB
testcase_38 AC 82 ms
75,772 KB
testcase_39 AC 79 ms
75,584 KB
testcase_40 AC 79 ms
75,792 KB
testcase_41 AC 71 ms
71,048 KB
testcase_42 AC 83 ms
75,588 KB
testcase_43 AC 71 ms
71,072 KB
testcase_44 AC 80 ms
75,404 KB
testcase_45 AC 79 ms
75,628 KB
testcase_46 AC 72 ms
71,100 KB
testcase_47 AC 81 ms
75,392 KB
testcase_48 AC 154 ms
75,612 KB
testcase_49 AC 232 ms
75,488 KB
testcase_50 AC 73 ms
71,104 KB
testcase_51 AC 70 ms
71,112 KB
testcase_52 AC 165 ms
75,316 KB
testcase_53 AC 240 ms
75,300 KB
testcase_54 AC 168 ms
75,772 KB
testcase_55 AC 94 ms
75,328 KB
testcase_56 AC 73 ms
70,940 KB
testcase_57 AC 75 ms
71,120 KB
testcase_58 AC 77 ms
71,064 KB
testcase_59 AC 72 ms
71,100 KB
testcase_60 AC 71 ms
71,148 KB
testcase_61 AC 72 ms
71,152 KB
testcase_62 AC 71 ms
71,104 KB
testcase_63 AC 72 ms
71,260 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:
        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
else:
    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