結果
| 問題 | No.3681 心の沸騰石 |
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2026-09-09 05:31:43 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 422µs | |
| コード長 | 846 bytes |
| 記録 | |
| コンパイル時間 | 1,998 ms |
| コンパイル使用メモリ | 330,716 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-09 05:32:14 |
| 合計ジャッジ時間 | 3,523 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 13 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>;
using u128=__int128_t;
using ll=long long;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll r,p,q,a,b,c,d;
cin>>r>>p>>q>>a>>b>>c>>d;
auto f=[&](ll x)->bool{
ll cost=x*p,e=d,f=0;
if(a>x) e+=a-x;
else f+=x-a;
if(b>x) e+=b-x;
else f+=x-b;
if(c>x) e+=c-x;
else f+=x-c;
if(f>e) return false;
cost+=q*f;
if(cost>r) return false;
return true;
};
ll ok=0,ng=2e9;
while(ng-ok>1){
ll mid=(ok+ng)/2;
if(f(mid)) ok=mid;
else ng=mid;
}
cout<<ok<<endl;
return 0;
}
umezo