結果

問題 No.2601 Very Poor
ユーザー karinohito
提出日時 2024-02-07 01:42:38
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 363 bytes
コンパイル時間 1,819 ms
コンパイル使用メモリ 198,600 KB
最終ジャッジ日時 2025-02-19 02:40:52
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
    int N,X,an=0,S=0;
    cin>>N>>X;
    vector<int> A(N);
    for(auto &a:A)cin>>a;
    deque<int> D;
    for(int R=0;R<N;R++){
        D.push_back(R);
        S+=A[R];
        while(S>X){
            S-=A[D.front()];
            D.pop_front();
        }
        an=max(an,S);
    }
    cout<<an<<endl;
}
0