結果

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main() {
    int n = 4;
    vector<P> ps(n);
    rep(i, n) cin >> ps[i].second;
    rep(i, n) cin >> ps[i].first;
    
    sort(ps.begin(), ps.end());
    
    ll T;
    cin >> T;
    
    ll ans = 0;
    for (auto [t, num] : ps) {
        ll x = min(T/t, num);
        ans += x;
        T -= x*t;
    }
    
    cout << ans << '\n';
    
    return 0;
}
0