結果
| 問題 |
No.3065 Speedrun (Normal)
|
| コンテスト | |
| ユーザー |
forest3
|
| 提出日時 | 2025-03-23 17:25:54 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 523 bytes |
| コンパイル時間 | 1,945 ms |
| コンパイル使用メモリ | 168,668 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-23 17:25:57 |
| 合計ジャッジ時間 | 2,893 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)
int main() {
vector<int> a(4), b(4);
rep(i, 4) cin >> a[i];
rep(i, 4) cin >> b[i];
ll t;
cin >> t;
using P = pair<ll, ll>;
vector<P> p(4);
rep(i, 4) p[i] = P(b[i], a[i]);
sort(p.begin(), p.end());
ll ans = 0;
rep(i, 4) {
if(p[i].first * p[i].second > t) {
ans += t / p[i].first;
break;
}
else {
ans += p[i].second;
t -= p[i].first * p[i].second;
}
}
cout << ans << endl;
}
forest3