結果

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

    vector <long long int> a(4),b(4);
    long long int t;

    cin >> a[0] >> a[1] >> a[2] >> a[3];
    cin >> b[0] >> b[1] >> b[2] >> b[3] >> t;

    vector <int> idx = {0,1,2,3};
    long long int res = 0;
    do
    {
        long long int sum = 0;
        long long int T = t;
        for(int i=0;i<4;i++)
        {
            long long int x = min(T/b[idx[i]],a[idx[i]]);
            sum += x;
            T -= (x*b[idx[i]]);
        }
        res = max(res,sum);
    }while(next_permutation(idx.begin(),idx.end()));
    cout << res << '\n';
	return 0;
}
0