結果
問題 | No.3065 Speedrun (Normal) |
ユーザー |
|
提出日時 | 2025-03-21 21:26:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 763 bytes |
コンパイル時間 | 2,199 ms |
コンパイル使用メモリ | 200,072 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-21 21:26:58 |
合計ジャッジ時間 | 2,826 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; template<class T> istream& operator >> (istream& is, vector<T>& vec) { for(T& x : vec) is >> x; return is; } template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { if(vec.empty()) return os; os << vec[0]; for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it; return os; } int main(){ ios::sync_with_stdio(false); cin.tie(0); ll t; vector<pair<ll,ll>> a(4); for(auto &&[x, y] : a) cin >> y; for(auto &&[x, y] : a) cin >> x; cin >> t; ll ans = 0; sort(a.begin(), a.end()); for(auto [x, y] : a){ ll d = min(y, t / x); t -= x * d; ans += d; } cout << ans << '\n'; }