結果

問題 No.3065 Speedrun (Normal)
ユーザー SnowBeenDiding
提出日時 2025-03-21 21:25:17
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 662 bytes
コンパイル時間 5,904 ms
コンパイル使用メモリ 333,676 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-21 21:25:26
合計ジャッジ時間 6,485 ms
ジャッジサーバーID
(参考情報)
judge3 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;

typedef long long ll;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);
    vector<ll> a(4), b(4);
    rep(i, 0, 4) cin >> a[i];
    rep(i, 0, 4) cin >> b[i];
    rep(i, 0, 4) rep(j, 0, 3) {
        if (b[j] > b[j + 1]) {
            swap(a[j], a[j + 1]);
            swap(b[j], b[j + 1]);
        }
    }
    ll t;
    cin >> t;
    ll ans = 0;
    rep(i, 0, 4) {
        ll add = min(t / b[i], a[i]);
        t -= add * b[i];
        ans += add;
    }
    cout << ans << endl;
}
0