結果
| 問題 | No.3684 chokudai_niku.png |
| コンテスト | |
| ユーザー |
msksknkn
|
| 提出日時 | 2026-09-12 19:50:41 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 770 ms / 2,000 ms |
| + 330µs | |
| コード長 | 713 bytes |
| 記録 | |
| コンパイル時間 | 1,446 ms |
| コンパイル使用メモリ | 85,568 KB |
| 実行使用メモリ | 63,340 KB |
| 最終ジャッジ日時 | 2026-09-12 19:51:17 |
| 合計ジャッジ時間 | 34,950 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 44 |
ソースコード
package no3684_chokudai_niku_png;
import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
long[] psum = new long[n + 1];
long[] a = new long[n + 1];
long[] b = new long[n + 1];
for(int i = 1;i <= n;i++) {
a[i] = sc.nextLong();
}for(int i = 1;i <= n;i++) {
b[i] = sc.nextLong();
psum[i] = psum[i - 1];
psum[i] += Math.max(0, a[i] - b[i]);
//System.out.print(psum[i] + " ");
}
long ans = Long.MIN_VALUE;;
for(int i = m;i <= n;i++) {
ans = Math.max(ans, psum[i] - psum[i - m]);
}System.out.println(ans);
}
}
msksknkn