結果
| 問題 | No.3684 chokudai_niku.png |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2026-09-07 15:49:24 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 29 ms / 2,000 ms |
| + 902µs | |
| コード長 | 693 bytes |
| 記録 | |
| コンパイル時間 | 151 ms |
| コンパイル使用メモリ | 53,904 KB |
| 実行使用メモリ | 7,168 KB |
| 最終ジャッジ日時 | 2026-09-07 15:49:32 |
| 合計ジャッジ時間 | 6,679 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 44 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3684.cc: No.3684 chokudai_niku.png - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
const int MAX_N = 200000;
/* typedef */
using ll = long long;
/* global variables */
int as[MAX_N], bs[MAX_N];
ll dss[MAX_N + 1];
/* subroutines */
/* main */
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) scanf("%d", as + i);
for (int i = 0; i < n; i++) scanf("%d", bs + i);
for (int i = 0; i < n; i++) dss[i + 1] = dss[i] + max(0, as[i] - bs[i]);
ll maxd = 0;
for (int i = 0; i + m <= n; i++)
maxd = max(maxd, dss[i + m] - dss[i]);
printf("%lld\n", maxd);
return 0;
}
tnakao0123