結果

問題 No.3684 chokudai_niku.png
コンテスト
ユーザー luminarian
提出日時 2026-09-09 21:01:31
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 728 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,532 ms
コンパイル使用メモリ 352,720 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-09 21:01:41
合計ジャッジ時間 9,261 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 43
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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;
  
  ll ma = 0;
  
  for (int s = 0; s <= N - M; s++) {
    
    ll cur = 0;
    
    for (int i = 0; i < M; i++) cur += max(0LL, A[s + i] - B[s + i]);
    
    chmax(ma, cur);
    
  }
  
  cout << ma << "\n";
  
  return 0;
  
}
0