結果
| 問題 | No.2694 The Early Bird Catches The Worm |
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2024-03-22 22:51:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 682 bytes |
| コンパイル時間 | 1,644 ms |
| コンパイル使用メモリ | 191,968 KB |
| 最終ジャッジ日時 | 2025-02-20 12:18:36 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 WA * 52 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int N,A[2<<17],B[2<<17];
long H,SA[2<<17],SB[2<<17];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>N>>H;
for(int i=0;i<N;i++)cin>>A[i],SA[i+1]=SA[i]+A[i];
for(int i=0;i<N;i++)cin>>B[i],SB[i+1]=SB[i]+B[i];
long ans=0,h=0;
int r=0;
for(int l=0;l<N;l++)
{
r=max(l,r);
if(r==l)h=B[r++];
while(r<N&&h<=H)
{
ans=max(ans,SA[r]-SA[l]);
h+=(r-l+1)*B[r];
r++;
}
if(h<=H)ans=max(ans,SA[r]-SA[l]);
// cout<<l<<' '<<r<<' '<<h<<' '<<SA[r]-SA[l]<<endl;
h-=SB[r]-SB[l];
}
cout<<ans<<endl;
}
nonon