結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-10-14 22:20:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 766 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 76,148 KB
最終ジャッジ日時 2023-09-08 22:17:12
合計ジャッジ時間 9,253 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
75,548 KB
testcase_01 AC 77 ms
75,476 KB
testcase_02 WA -
testcase_03 AC 134 ms
75,776 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 121 ms
75,728 KB
testcase_08 AC 72 ms
71,144 KB
testcase_09 AC 74 ms
71,148 KB
testcase_10 AC 73 ms
71,240 KB
testcase_11 AC 72 ms
71,284 KB
testcase_12 AC 73 ms
71,188 KB
testcase_13 AC 126 ms
75,652 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 122 ms
75,724 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 73 ms
71,220 KB
testcase_23 AC 71 ms
71,324 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 72 ms
71,224 KB
testcase_28 AC 125 ms
75,576 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 123 ms
75,572 KB
testcase_33 AC 124 ms
75,780 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 121 ms
75,836 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 72 ms
71,152 KB
testcase_42 WA -
testcase_43 AC 72 ms
71,320 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 71 ms
71,472 KB
testcase_47 WA -
testcase_48 AC 125 ms
75,660 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 122 ms
75,732 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 AC 70 ms
71,124 KB
testcase_57 WA -
testcase_58 WA -
testcase_59 AC 71 ms
71,344 KB
testcase_60 WA -
testcase_61 AC 71 ms
71,156 KB
testcase_62 WA -
testcase_63 WA -
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 <= 2*10**7:
        if cnt * a <= t:
            ans = min(ans,x*cnt + t-a * cnt)
        else:
#             print(a*cnt,-((-(a*cnt-t))//b))
            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 >=  - 2*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))
            if p_ans != ans:
                print(cnt,ans,y * cnt , ((t - b*cnt)//a) * x , t - (cnt * b  + ((t - b*cnt)//a) * a))
        cnt += 1
print(ans)
0