結果

問題 No.2601 Very Poor
ユーザー karinohitokarinohito
提出日時 2024-03-25 18:21:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 471 bytes
コンパイル時間 2,692 ms
コンパイル使用メモリ 206,508 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-25 18:21:42
合計ジャッジ時間 7,005 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 3 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 3 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 3 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 3 ms
6,676 KB
testcase_15 AC 66 ms
6,676 KB
testcase_16 AC 66 ms
6,676 KB
testcase_17 AC 67 ms
6,676 KB
testcase_18 AC 65 ms
6,676 KB
testcase_19 AC 65 ms
6,676 KB
testcase_20 AC 66 ms
6,676 KB
testcase_21 AC 104 ms
6,676 KB
testcase_22 AC 78 ms
6,676 KB
testcase_23 AC 65 ms
6,676 KB
testcase_24 AC 65 ms
6,676 KB
testcase_25 AC 66 ms
6,676 KB
testcase_26 AC 65 ms
6,676 KB
testcase_27 AC 66 ms
6,676 KB
testcase_28 AC 66 ms
6,676 KB
testcase_29 AC 66 ms
6,676 KB
testcase_30 AC 65 ms
6,676 KB
testcase_31 AC 65 ms
6,676 KB
testcase_32 AC 65 ms
6,676 KB
testcase_33 AC 65 ms
6,676 KB
testcase_34 AC 66 ms
6,676 KB
testcase_35 AC 2 ms
6,676 KB
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int N,X,an=0,S=0;
    cin>>N>>X;
    vector<int> A(N);
    int ts=0;
    for(auto &a:A){
        cin>>a;
        ts+=a;
    }
    if(ts<=X){
        cout<<ts<<endl;
        return 0;
    }
    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