結果
問題 | No.2601 Very Poor |
ユーザー |
![]() |
提出日時 | 2024-01-12 21:34:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 461 bytes |
コンパイル時間 | 2,226 ms |
コンパイル使用メモリ | 190,436 KB |
最終ジャッジ日時 | 2025-02-18 17:51:32 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 WA * 2 RE * 20 |
ソースコード
#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<=4*N;i++)S[i]=S[i-1]+A[i-1]; int l=0,r=0; long ans=0; while(l<2*N) { if(r==2*N||S[r]-S[l]>X)l++; else r++; ans=max(ans,S[r-1]-S[l]); } cout << ans << endl; }