結果
問題 | No.2601 Very Poor |
ユーザー |
![]() |
提出日時 | 2024-01-12 21:40:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 542 bytes |
コンパイル時間 | 2,053 ms |
コンパイル使用メモリ | 190,444 KB |
最終ジャッジ日時 | 2025-02-18 17:55:04 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 WA * 2 |
ソースコード
#include<bits/stdc++.h> using namespace std; int N,X; long A[4<<17],S[4<<17]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N>>X; for(int i=0;i<N;i++) { cin>>A[i]; A[i+N]=A[i]; } for(int i=1;i<=2*N;i++)S[i]=S[i-1]+A[i-1]; long ans=0; for(int i=0;i<N;i++) { int l=i,r=i+N; while(r-l>1) { int m=(r+l)/2; if(S[m]-S[i]<=X)l=m; else r=m; } ans=max(ans,S[l]-S[i]); } cout << ans << endl; }