結果
| 問題 |
No.865 24時間降水量
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-16 22:32:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 583 bytes |
| コンパイル時間 | 1,605 ms |
| コンパイル使用メモリ | 168,224 KB |
| 実行使用メモリ | 13,760 KB |
| 最終ジャッジ日時 | 2024-09-22 18:30:49 |
| 合計ジャッジ時間 | 5,377 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | WA * 15 TLE * 1 -- * 2 |
ソースコード
#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);
}
}