結果
| 問題 | No.3681 心の沸騰石 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-05 13:23:57 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 348µs | |
| コード長 | 533 bytes |
| 記録 | |
| コンパイル時間 | 1,976 ms |
| コンパイル使用メモリ | 332,744 KB |
| 実行使用メモリ | 9,760 KB |
| 最終ジャッジ日時 | 2026-09-05 13:24:04 |
| 合計ジャッジ時間 | 3,299 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll r, p, q;
cin >> r >> p >> q;
vector<ll> a(4);
for(auto &&v : a) cin >> v;
ll ok = 0, ng = accumulate(a.begin(), a.end(), 0LL) / 3 + 1;
while(ok + 1 < ng){
ll mid = (ok + ng) / 2;
ll cost = mid * p;
for(int i = 0; i < 3; i++){
cost += max(0LL, mid - a[i]) * q;
}
(cost <= r ? ok : ng) = mid;
}
cout << ok << '\n';
}