結果

問題 No.865 24時間降水量
コンテスト
ユーザー ooaiu
提出日時 2026-08-23 15:26:52
言語 C++23
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 187 ms / 2,000 ms
+ 667µs
コード長 778 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,477 ms
コンパイル使用メモリ 336,628 KB
実行使用メモリ 7,040 KB
最終ジャッジ日時 2026-08-23 15:27:05
合計ジャッジ時間 5,185 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#include <atcoder/segtree>
using namespace std;
int op(int a, int b) { return max(a,b); }
int e() { return -1e9; }
#define rep(i,n) for(int i = 0; i < (n); i++)
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;
	cin >> N;
	vector<int>A(N);
	rep(i, N) cin >> A[i];
	atcoder::segtree<int,op,e>seg(N-24+1);
	for(int i = 0; i < N - 24 + 1; i++) {
		int sm = 0;
		for(int j = 0; j < 24; j++) sm += A[i+j];
		seg.set(i, sm);
	}
	auto Update = [&](int i) {
		for(int j = max(0,i-23); j <= i && j + 23 < N; j++) {
			int sm = 0;
			for(int k = 0; k < 24; k++) {
				sm += A[j+k];
			}
			seg.set(j,sm);
		}

	};
	int Q;
	cin >> Q;
	while(Q--) {
		int t, v;
		cin >> t >> v;
		t--;
		A[t] = v;
		Update(t);
		cout<<seg.all_prod()<<"\n";
	}
}
0