結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-10-14 22:09:54
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 611 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 76,108 KB
最終ジャッジ日時 2023-09-08 21:51:42
合計ジャッジ時間 9,820 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
75,544 KB
testcase_01 AC 77 ms
75,680 KB
testcase_02 AC 91 ms
75,556 KB
testcase_03 WA -
testcase_04 AC 168 ms
75,928 KB
testcase_05 AC 72 ms
71,216 KB
testcase_06 AC 72 ms
71,376 KB
testcase_07 WA -
testcase_08 AC 72 ms
71,292 KB
testcase_09 AC 70 ms
71,516 KB
testcase_10 AC 72 ms
71,028 KB
testcase_11 AC 73 ms
71,128 KB
testcase_12 AC 73 ms
71,524 KB
testcase_13 WA -
testcase_14 AC 169 ms
75,860 KB
testcase_15 AC 72 ms
71,416 KB
testcase_16 AC 72 ms
71,372 KB
testcase_17 WA -
testcase_18 AC 81 ms
75,876 KB
testcase_19 AC 85 ms
75,880 KB
testcase_20 AC 96 ms
75,752 KB
testcase_21 AC 79 ms
75,812 KB
testcase_22 AC 72 ms
71,324 KB
testcase_23 AC 73 ms
71,116 KB
testcase_24 AC 88 ms
75,760 KB
testcase_25 AC 84 ms
75,796 KB
testcase_26 AC 78 ms
75,912 KB
testcase_27 AC 72 ms
71,276 KB
testcase_28 WA -
testcase_29 AC 168 ms
75,720 KB
testcase_30 AC 74 ms
71,496 KB
testcase_31 AC 70 ms
71,172 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 168 ms
75,916 KB
testcase_35 AC 71 ms
71,460 KB
testcase_36 AC 72 ms
71,372 KB
testcase_37 WA -
testcase_38 AC 80 ms
75,804 KB
testcase_39 AC 78 ms
75,812 KB
testcase_40 AC 80 ms
75,808 KB
testcase_41 WA -
testcase_42 AC 82 ms
75,820 KB
testcase_43 AC 71 ms
71,524 KB
testcase_44 AC 80 ms
75,592 KB
testcase_45 AC 79 ms
75,928 KB
testcase_46 AC 71 ms
71,360 KB
testcase_47 AC 80 ms
75,752 KB
testcase_48 WA -
testcase_49 AC 168 ms
75,724 KB
testcase_50 AC 73 ms
71,376 KB
testcase_51 AC 72 ms
71,524 KB
testcase_52 WA -
testcase_53 AC 175 ms
75,832 KB
testcase_54 AC 131 ms
75,916 KB
testcase_55 AC 87 ms
75,788 KB
testcase_56 AC 71 ms
71,068 KB
testcase_57 AC 70 ms
71,212 KB
testcase_58 AC 71 ms
71,364 KB
testcase_59 AC 71 ms
71,432 KB
testcase_60 AC 72 ms
71,416 KB
testcase_61 AC 73 ms
71,452 KB
testcase_62 AC 72 ms
71,420 KB
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-x * 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:
            ans = min(ans,y * cnt +  ((t - b*cnt)//a) * x + t - (cnt * b  + ((t - b*cnt)//a) * a))
        cnt += 1
print(ans)
0