結果
| 問題 | No.3684 chokudai_niku.png |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-09 21:04:22 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 21 ms / 2,000 ms |
| + 916µs | |
| コード長 | 759 bytes |
| 記録 | |
| コンパイル時間 | 2,352 ms |
| コンパイル使用メモリ | 352,992 KB |
| 実行使用メモリ | 8,320 KB |
| 最終ジャッジ日時 | 2026-09-09 21:04:32 |
| 合計ジャッジ時間 | 8,953 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 44 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vl vector<ll>
#define vvl vector<vl>
template<class T> inline int chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline int chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; }
auto _ = []() { ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }();
int main() {
ll N, M; cin >> N >> M;
vl A(N), B(N);
for (auto& x : A) cin >> x; for (auto& x : B) cin >> x;
vl S(N + 1);
for (int i = 0; i < N; i++) S[i + 1] = S[i] + max(0LL, A[i] - B[i]);
ll ma = 0;
for (int s = 0; s <= N - M; s++) {
ll cur = S[s + M] - S[s];
chmax(ma, cur);
}
cout << ma << "\n";
return 0;
}