結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー rogi52rogi52
提出日時 2022-10-15 01:16:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 688 bytes
コンパイル時間 2,195 ms
コンパイル使用メモリ 198,100 KB
実行使用メモリ 5,256 KB
最終ジャッジ日時 2023-09-09 01:42:27
合計ジャッジ時間 20,946 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 221 ms
4,380 KB
testcase_01 AC 217 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 216 ms
4,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 222 ms
4,384 KB
testcase_08 WA -
testcase_09 AC 223 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 224 ms
4,380 KB
testcase_13 AC 219 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 223 ms
4,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 222 ms
4,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 218 ms
4,384 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 222 ms
4,380 KB
testcase_33 AC 218 ms
4,380 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 223 ms
4,384 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 224 ms
4,380 KB
testcase_47 WA -
testcase_48 AC 219 ms
4,376 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 223 ms
4,380 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 AC 221 ms
4,384 KB
testcase_57 WA -
testcase_58 WA -
testcase_59 AC 222 ms
4,380 KB
testcase_60 WA -
testcase_61 AC 220 ms
4,384 KB
testcase_62 WA -
testcase_63 AC 220 ms
4,376 KB
testcase_64 WA -
testcase_65 AC 219 ms
4,380 KB
testcase_66 WA -
testcase_67 AC 220 ms
4,376 KB
testcase_68 WA -
testcase_69 AC 220 ms
4,384 KB
testcase_70 WA -
testcase_71 AC 222 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ll T,X,A,Y,B; cin >> T >> X >> A >> Y >> B;
    if(T < 0) {
        swap(X, Y);
        swap(A, B);
    }
    ll ans = numeric_limits<ll>::max();
    for(ll x = 0; x <= ll(1e7); x++) {
        ll y = (A * x - T + B - 1) / B;
        ll z = T - (A * x - B * y);
        if(0 <= y && 0 <= z)
            ans = min(ans, X * x + Y * y + z);
        y = (A * x - T) / B;
        z = T - (A * x - B * y);
        if(0 <= y && 0 <= z)
            ans = min(ans, X * x + Y * y + z);
    }
    cout << ans << endl;
}
0