結果

問題 No.865 24時間降水量
ユーザー autumn-eelautumn-eel
提出日時 2019-08-16 22:30:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 575 bytes
コンパイル時間 1,810 ms
コンパイル使用メモリ 167,396 KB
実行使用メモリ 8,680 KB
最終ジャッジ日時 2023-10-24 01:27:30
合計ジャッジ時間 5,883 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 3 ms
4,348 KB
testcase_07 AC 3 ms
4,348 KB
testcase_08 AC 3 ms
4,348 KB
testcase_09 AC 3 ms
4,348 KB
testcase_10 AC 9 ms
4,348 KB
testcase_11 AC 9 ms
4,348 KB
testcase_12 AC 9 ms
4,348 KB
testcase_13 AC 9 ms
4,348 KB
testcase_14 AC 9 ms
4,348 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll>P;

int a[300000];
int main(){
	int n;cin>>n;
	rep(i,n)scanf("%d",&a[i]);
	int Max=0;
	rep(i,n-24+1){
		int sum=0;
		rep(j,24)sum+=a[i+j];
		Max=max(Max,sum);
	}
	int q;cin>>q;
	rep(i,q){
		int t,v;scanf("%d%d",&t,&v);t--;
		a[t]=v;
		int s=max(0,t-24+1);
		if(s+24<=n){
			int sum=0;
			rep(j,24)sum+=a[s+j];
			Max=max(Max,sum);
			while(s+25<=n){
				sum+=a[s+24];
				sum-=a[s];
				s++;
				Max=max(Max,sum);
			}
		}
		printf("%d\n",Max);
	}
}
0