結果

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

ソースコード

diff #

#include <bits/stdc++.h>

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int A[4], B[4];
  long long T;
  for (int i = 0; i < 4; i++) {
    std::cin >> A[i];
  }
  for (int i = 0; i < 4; i++) {
    std::cin >> B[i];
  }
  std::cin >> T;
  int P[4];
  std::iota(P, P + 4, 0);
  std::sort(P, P + 4, [&](int i, int j){
    return B[i] < B[j];
  });
  long long ans = 0;
  for (auto i : P) {
    if (T >= 1LL * A[i] * B[i]) {
      ans += A[i];
      T -= 1LL * A[i] * B[i];
    } else {
      ans += T / B[i];
      break;
    }
  }
  std::cout << ans << '\n';
}
0