結果
| 問題 | No.3681 心の沸騰石 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-05 13:31:10 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 324µs | |
| コード長 | 675 bytes |
| 記録 | |
| コンパイル時間 | 2,095 ms |
| コンパイル使用メモリ | 338,128 KB |
| 実行使用メモリ | 9,768 KB |
| 最終ジャッジ日時 | 2026-09-05 13:31:37 |
| 合計ジャッジ時間 | 3,422 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
ll r, p, q;
cin >> r >> p >> q;
vector<ll> a(3);
ll d;
ll s = 0;
rep(i, 3) cin >> a[i], s += a[i];
cin >> d;
s += d;
sort(a.begin(), a.end());
vector<ll> x{a[0], min(s / 3, a[1]), min(s / 3, a[2]), s / 3};
for (int i = 2; i >= 0; i--)
x[i + 1] -= x[i];
ll ans = 0;
rep(i, 4) {
ll d = p + q * i;
ll c = min(r / d, x[i]);
r -= c * d;
ans += c;
}
cout << ans << endl;
return 0;
}