結果

問題 No.865 24時間降水量
ユーザー e869120e869120
提出日時 2019-08-14 21:53:15
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 661 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 66,864 KB
実行使用メモリ 4,588 KB
最終ジャッジ日時 2023-10-19 18:15:00
合計ジャッジ時間 2,129 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 3 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 6 ms
4,348 KB
testcase_11 AC 6 ms
4,348 KB
testcase_12 AC 6 ms
4,348 KB
testcase_13 AC 6 ms
4,348 KB
testcase_14 AC 6 ms
4,348 KB
testcase_15 AC 102 ms
4,588 KB
testcase_16 AC 100 ms
4,588 KB
testcase_17 AC 100 ms
4,588 KB
testcase_18 AC 2 ms
4,372 KB
testcase_19 AC 2 ms
4,372 KB
testcase_20 AC 2 ms
4,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
#pragma warning (disable: 4996)

int N, Q, A[200009], maxn;

int main() {
	scanf("%d", &N);
	for (int i = 1; i <= N; i++) scanf("%d", &A[i]);
	for (int i = 1; i <= N - 23; i++) {
		int sum = 0;
		for (int j = i; j <= i + 23; j++) sum += A[j];
		maxn = max(maxn, sum);
	}
	scanf("%d", &Q);
	for (int i = 1; i <= Q; i++) {
		int t, v; scanf("%d%d", &t, &v);
		A[t] = v;
		for (int j = t - 23; j <= t; j++) {
			int cl = j, cr = j + 23; if (cl <= 0 || cr > N) continue;
			int sum = 0;
			for (int k = cl; k <= cr; k++) sum += A[k];
			maxn = max(maxn, sum);
		}
		printf("%d\n", maxn);
	}
	return 0;
}
0