結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-10-14 22:21:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 770 bytes
コンパイル時間 1,348 ms
コンパイル使用メモリ 86,768 KB
実行使用メモリ 76,028 KB
最終ジャッジ日時 2023-09-08 22:21:33
合計ジャッジ時間 9,495 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
75,664 KB
testcase_01 AC 78 ms
75,600 KB
testcase_02 AC 92 ms
75,440 KB
testcase_03 AC 126 ms
75,580 KB
testcase_04 AC 172 ms
75,484 KB
testcase_05 AC 73 ms
71,064 KB
testcase_06 AC 73 ms
71,180 KB
testcase_07 AC 127 ms
75,872 KB
testcase_08 AC 76 ms
71,192 KB
testcase_09 AC 72 ms
71,264 KB
testcase_10 AC 72 ms
71,088 KB
testcase_11 AC 73 ms
71,008 KB
testcase_12 AC 71 ms
71,300 KB
testcase_13 AC 128 ms
75,888 KB
testcase_14 AC 172 ms
75,640 KB
testcase_15 AC 74 ms
71,092 KB
testcase_16 AC 72 ms
71,108 KB
testcase_17 AC 127 ms
75,600 KB
testcase_18 AC 84 ms
75,576 KB
testcase_19 AC 85 ms
75,604 KB
testcase_20 AC 97 ms
75,780 KB
testcase_21 AC 82 ms
75,484 KB
testcase_22 AC 73 ms
71,088 KB
testcase_23 AC 73 ms
71,068 KB
testcase_24 AC 84 ms
75,564 KB
testcase_25 AC 86 ms
75,464 KB
testcase_26 AC 82 ms
75,600 KB
testcase_27 AC 73 ms
71,004 KB
testcase_28 AC 129 ms
75,656 KB
testcase_29 AC 173 ms
75,552 KB
testcase_30 AC 73 ms
71,176 KB
testcase_31 AC 72 ms
71,076 KB
testcase_32 AC 129 ms
75,516 KB
testcase_33 AC 126 ms
75,748 KB
testcase_34 AC 172 ms
75,528 KB
testcase_35 AC 72 ms
71,324 KB
testcase_36 AC 71 ms
71,112 KB
testcase_37 AC 124 ms
75,700 KB
testcase_38 AC 82 ms
75,596 KB
testcase_39 AC 82 ms
75,552 KB
testcase_40 AC 81 ms
75,716 KB
testcase_41 AC 74 ms
71,064 KB
testcase_42 AC 83 ms
75,592 KB
testcase_43 AC 73 ms
70,996 KB
testcase_44 AC 81 ms
75,480 KB
testcase_45 AC 81 ms
75,460 KB
testcase_46 AC 72 ms
71,216 KB
testcase_47 AC 81 ms
75,764 KB
testcase_48 AC 125 ms
75,880 KB
testcase_49 AC 176 ms
75,468 KB
testcase_50 AC 72 ms
70,896 KB
testcase_51 AC 73 ms
71,224 KB
testcase_52 AC 128 ms
75,604 KB
testcase_53 AC 175 ms
75,752 KB
testcase_54 AC 132 ms
75,556 KB
testcase_55 AC 87 ms
76,028 KB
testcase_56 AC 73 ms
71,300 KB
testcase_57 AC 73 ms
71,320 KB
testcase_58 AC 73 ms
71,192 KB
testcase_59 AC 74 ms
71,260 KB
testcase_60 AC 72 ms
71,008 KB
testcase_61 AC 71 ms
71,204 KB
testcase_62 AC 75 ms
71,196 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-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