結果

問題 No.865 24時間降水量
ユーザー autumn-eelautumn-eel
提出日時 2019-08-16 22:32:10
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 583 bytes
コンパイル時間 1,855 ms
コンパイル使用メモリ 167,692 KB
実行使用メモリ 11,356 KB
最終ジャッジ日時 2023-10-24 01:33:02
合計ジャッジ時間 5,939 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
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+1<=i&&s+25<=n){
				sum+=a[s+24];
				sum-=a[s];
				s++;
				Max=max(Max,sum);
			}
		}
		printf("%d\n",Max);
	}
}
0