結果

問題 No.3065 Speedrun (Normal)
ユーザー ゼリトキ
提出日時 2025-03-21 21:27:17
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 709 bytes
コンパイル時間 3,098 ms
コンパイル使用メモリ 280,036 KB
実行使用メモリ 14,776 KB
最終ジャッジ日時 2025-03-21 21:27:25
合計ジャッジ時間 6,568 ms
ジャッジサーバーID
(参考情報)
judge4 / judge7
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 TLE * 1 -- * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define INF 9e18;
int main(){
    cin.tie(0)->sync_with_stdio(0);
    cout.tie(0);
    vector<pair<int,int>>data(4);
    rep(i,4) cin>>data.at(i).second;
    rep(i,4) cin>>data.at(i).first;
    ll T;
    cin>>T;
    sort(data.begin(),data.end());
    int pos=0;
    ll ans=0;
    while(true){
        T-=data.at(pos).first;
        data.at(pos).second--;
        ans++;
        if(T<0){
            ans--;
            break;
        }
        if(data.at(pos).second==0){
            pos++;
            if(pos==4){
                break;
            }
        }
    }
    cout<<ans<<endl;
}
0