結果

問題 No.3065 Speedrun (Normal)
ユーザー umezo
提出日時 2025-03-22 01:52:41
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 651 bytes
コンパイル時間 4,549 ms
コンパイル使用メモリ 283,108 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2025-03-22 01:52:46
合計ジャッジ時間 5,036 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  V<ll> A(4),B(4);
  rep(i,4) cin>>A[i];
  rep(i,4) cin>>B[i];
  ll t;
  cin>>t;
  V<pair<ll,ll>> P(4);
  rep(i,4) P[i]={B[i],A[i]};
  sort(ALL(P));
  ll ans=0;
  rep(i,4){
    if(P[i].first*P[i].second>t){
      cout<<ans+t/P[i].first<<endl;
      return 0;
    }
    ans+=P[i].second;
    t-=P[i].first*P[i].second;
  }
  cout<<ans<<endl;
  
  return 0;
}
0