結果
| 問題 | No.3684 chokudai_niku.png |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-20 22:22:26 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 436 bytes |
| 記録 | |
| コンパイル時間 | 1,914 ms |
| コンパイル使用メモリ | 332,612 KB |
| 実行使用メモリ | 9,796 KB |
| 最終ジャッジ日時 | 2026-09-05 12:44:38 |
| 合計ジャッジ時間 | 7,131 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 14 WA * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int n,m;
cin >> n >> m;
vector<ll>num (n);
ll now = 0;
for(int i=0;i<n;i++){
cin >> num[i];
if(num[i] < 0) num[i] = 0;
if(i < m) now += num[i];
}
ll ans = now;
for(int i=0;i+m<n;i++){
now -= num[i];
now += num[i+m];
ans = max(ans,now);
}
cout << ans << endl;
}