結果

問題 No.3684 chokudai_niku.png
コンテスト
ユーザー よには
提出日時 2026-07-11 13:07:22
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 894 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,805 ms
コンパイル使用メモリ 413,372 KB
実行使用メモリ 9,788 KB
最終ジャッジ日時 2026-09-05 12:38:31
合計ジャッジ時間 11,437 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 14 WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#if __has_include(<yoniha/all.h>)
#include <yoniha/all.h>
using namespace atcoder;
#else
#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#endif
using namespace std;

#define int long long
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)((n) - 1); i >= 0; i--)
template <typename T> bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template <typename T> bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

// using mint = modint;

signed main(){
  int n, m; cin >> n >> m;
  vector<int> a(n); for(auto&& ai : a) cin >> ai, chmax(ai, 0ll);
  vector asum(n + 1, 0ll); rep(i, n) asum.at(i + 1) = asum.at(i) + a.at(i);
  int ans = 0;
  rep(i, n - m + 1) chmax(ans, asum.at(i + m) - asum.at(i));
  println("{}", ans);
}
0