結果
問題 | No.2099 [Cherry Alpha B] Time Machine |
ユーザー | bit_kyopro |
提出日時 | 2022-10-14 22:05:35 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 131 ms / 2,000 ms |
コード長 | 632 bytes |
コンパイル時間 | 180 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 59,648 KB |
最終ジャッジ日時 | 2024-06-26 14:36:28 |
合計ジャッジ時間 | 10,253 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 105 ms
58,112 KB |
testcase_01 | AC | 110 ms
58,368 KB |
testcase_02 | AC | 125 ms
58,368 KB |
testcase_03 | AC | 87 ms
59,392 KB |
testcase_04 | AC | 97 ms
58,112 KB |
testcase_05 | AC | 122 ms
58,112 KB |
testcase_06 | AC | 107 ms
58,112 KB |
testcase_07 | AC | 81 ms
58,752 KB |
testcase_08 | AC | 110 ms
58,112 KB |
testcase_09 | AC | 113 ms
58,624 KB |
testcase_10 | AC | 111 ms
58,496 KB |
testcase_11 | AC | 110 ms
58,368 KB |
testcase_12 | AC | 112 ms
58,112 KB |
testcase_13 | AC | 87 ms
58,880 KB |
testcase_14 | AC | 95 ms
58,624 KB |
testcase_15 | AC | 118 ms
58,368 KB |
testcase_16 | AC | 108 ms
58,112 KB |
testcase_17 | AC | 83 ms
59,008 KB |
testcase_18 | AC | 125 ms
59,648 KB |
testcase_19 | AC | 128 ms
59,392 KB |
testcase_20 | AC | 129 ms
59,392 KB |
testcase_21 | AC | 130 ms
59,520 KB |
testcase_22 | AC | 110 ms
58,496 KB |
testcase_23 | AC | 110 ms
58,112 KB |
testcase_24 | AC | 126 ms
59,392 KB |
testcase_25 | AC | 129 ms
59,520 KB |
testcase_26 | AC | 128 ms
59,520 KB |
testcase_27 | AC | 112 ms
58,496 KB |
testcase_28 | AC | 82 ms
59,136 KB |
testcase_29 | AC | 93 ms
58,112 KB |
testcase_30 | AC | 118 ms
58,368 KB |
testcase_31 | AC | 107 ms
58,624 KB |
testcase_32 | AC | 81 ms
59,520 KB |
testcase_33 | AC | 83 ms
59,008 KB |
testcase_34 | AC | 93 ms
58,624 KB |
testcase_35 | AC | 120 ms
58,240 KB |
testcase_36 | AC | 106 ms
58,624 KB |
testcase_37 | AC | 85 ms
58,752 KB |
testcase_38 | AC | 129 ms
59,264 KB |
testcase_39 | AC | 127 ms
59,520 KB |
testcase_40 | AC | 129 ms
59,520 KB |
testcase_41 | AC | 115 ms
58,368 KB |
testcase_42 | AC | 131 ms
59,648 KB |
testcase_43 | AC | 112 ms
58,112 KB |
testcase_44 | AC | 130 ms
59,520 KB |
testcase_45 | AC | 129 ms
59,264 KB |
testcase_46 | AC | 109 ms
58,496 KB |
testcase_47 | AC | 125 ms
59,520 KB |
testcase_48 | AC | 84 ms
59,008 KB |
testcase_49 | AC | 92 ms
58,880 KB |
testcase_50 | AC | 116 ms
58,112 KB |
testcase_51 | AC | 104 ms
58,112 KB |
testcase_52 | AC | 87 ms
58,752 KB |
testcase_53 | AC | 114 ms
58,412 KB |
testcase_54 | AC | 127 ms
58,112 KB |
testcase_55 | AC | 125 ms
59,648 KB |
testcase_56 | AC | 103 ms
58,496 KB |
testcase_57 | AC | 121 ms
58,496 KB |
testcase_58 | AC | 123 ms
58,624 KB |
testcase_59 | AC | 113 ms
58,624 KB |
testcase_60 | AC | 124 ms
58,240 KB |
testcase_61 | AC | 104 ms
58,112 KB |
testcase_62 | AC | 121 ms
58,240 KB |
testcase_63 | AC | 102 ms
58,112 KB |
testcase_64 | AC | 123 ms
58,624 KB |
testcase_65 | AC | 117 ms
59,008 KB |
testcase_66 | AC | 125 ms
58,880 KB |
testcase_67 | AC | 115 ms
59,264 KB |
testcase_68 | AC | 128 ms
58,496 KB |
testcase_69 | AC | 106 ms
58,240 KB |
testcase_70 | AC | 126 ms
58,112 KB |
testcase_71 | AC | 126 ms
59,008 KB |
ソースコード
t = int(input()) x, a = map(int, input().split()) y, b = map(int, input().split()) x = min(x, a) ans = 10**20 if t >= 0: for c2 in range(10**7 + 1): now = c2*a cost = c2*x if now <= t: cost += t - now else: c3 = (now - t + b - 1)//b now -= c3*b cost += c3*y + t - now ans = min(ans, cost) else: c3 = (-t + b - 1)//b for _ in range(10**7 + 1): cost = c3*y now = -c3*b c2 = (t - now)//a cost += c2*x now += c2*a cost += t - now ans = min(ans, cost) c3 += 1 print(ans)