結果
| 問題 |
No.865 24時間降水量
|
| コンテスト | |
| ユーザー |
takeya_okino
|
| 提出日時 | 2019-08-18 09:31:31 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,042 bytes |
| コンパイル時間 | 2,199 ms |
| コンパイル使用メモリ | 77,460 KB |
| 実行使用メモリ | 85,100 KB |
| 最終ジャッジ日時 | 2024-10-01 13:38:16 |
| 合計ジャッジ時間 | 12,756 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 RE * 2 |
| other | RE * 15 TLE * 3 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] rui = new long[n];
long[] a = new long[n];
for(int i = 0; i < n; i++) {
a[i] = sc.nextLong();
if(i == 0) {
rui[i] = a[i];
} else {
rui[i] = rui[i - 1] + a[i];
}
}
long[] kukan = new long[n - 23];
for(int i = 0; i < n - 23; i++) {
if(i == 0) {
kukan[i] = rui[i + 23];
} else {
kukan[i] = rui[i + 23] - rui[i - 1];
}
}
long ans = 0;
for(int i = 0; i < n - 23; i++) {
ans = Math.max(ans, kukan[i]);
}
int q = sc.nextInt();
for(int i = 0; i < q; i++) {
int t = sc.nextInt() - 1;
long v = sc.nextLong();
long sa = v - a[t];
a[t] = v;
for(int j = t - 23; j <= t; j++) {
if(j >= 0) {
kukan[j] = kukan[j] + sa;
ans = Math.max(ans, kukan[j]);
}
}
System.out.println(ans);
}
}
}
takeya_okino