結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    vector<pair<ll, ll>> arr(4);
    for (int i = 0; i < 4; i++) cin >> arr[i].second;
    for (int i = 0; i < 4; i++) cin >> arr[i].first;
    ll t; cin >> t;
    sort(arr.begin(), arr.end());
    ll ans = 0;
    for (int i = 0; i < 4; i++) {
        int num = min(t / arr[i].first, arr[i].second);
        ans += num;
        t -= num * arr[i].first;
    }
    cout << ans << "\n";
    return 0;
}
0