結果
| 問題 | No.3604 Min of Max of Div of Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-31 21:28:01 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 75 ms / 2,000 ms |
| + 942µs | |
| コード長 | 938 bytes |
| 記録 | |
| コンパイル時間 | 1,123 ms |
| コンパイル使用メモリ | 214,976 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-07-31 21:28:05 |
| 合計ジャッジ時間 | 3,805 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N; cin >> N;
vector<long long> A(N),B(N);
for(auto &a : A) cin >> a;
for(auto &b : B) cin >> b;
double low = 0,high = 1001001001;
for(int t=0; t<70; t++){
double mid = (high+low)/2;
vector<double> D(N);
for(int i=0; i<N; i++) D.at(i) = A.at(i)-B.at(i)*mid;
vector<double> R(N);
double big = 0;
for(int i=N-1; i>=0; i--){
R.at(i) = big;
big += D.at(i),big = max(0.0,big);
}
big = 0;
bool ok = false;
for(int i=0; i<N; i++){
double now = D.at(i)+R.at(i)+big;
if(now <= 0){ok = true; break;}
big += D.at(i),big = max(0.0,big);
}
if(ok) high = mid;
else low = mid;
}
cout << fixed << setprecision(20) << high << "\n";
}