結果
問題 | No.865 24時間降水量 |
ユーザー |
![]() |
提出日時 | 2019-08-17 03:33:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 391 ms / 2,000 ms |
コード長 | 467 bytes |
コンパイル時間 | 137 ms |
コンパイル使用メモリ | 82,052 KB |
実行使用メモリ | 105,972 KB |
最終ジャッジ日時 | 2024-09-24 18:07:33 |
合計ジャッジ時間 | 3,473 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
N=int(input())A=list(map(int,input().split()))Q=int(input())Query=[list(map(int,input().split())) for i in range(Q)]S=sum(A[:24])MAX=Sfor i in range(24,N):S+=A[i]-A[i-24]MAX=max(MAX,S)def MAX_from_i(q):from_q=max(q,24)S=sum(A[from_q-24:from_q])MAX=Sfor i in range(from_q,min(q+25,N)):S+=A[i]-A[i-24]MAX=max(MAX,S)return MAXfor t,v in Query:A[t-1]=vMAX=max(MAX,MAX_from_i(t-1))print(MAX)