結果

問題 No.865 24時間降水量
ユーザー kohei2019
提出日時 2022-05-04 14:03:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,552 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 82,668 KB
実行使用メモリ 104,540 KB
最終ジャッジ日時 2024-07-03 16:41:11
合計ジャッジ時間 7,430 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N = int(input())
lsA = list(map(int,input().split()))
Q = int(input())
lsTV = []
for i in range(Q):
    t,v = map(int,input().split())
    lsTV.append((t-1,v))
maxp = 0
for i in range(N-23):
    maxp = max(maxp,sum(lsA[i:i+24]))

for i in range(Q):
    t,v = lsTV[i]
    l,r = max(0,t-24),t+24
    lsA[t] = v
    for j in range(l,r):
        sm = sum(lsA[j:j+24])
        if maxp < sm:
            maxp = sm
    print(maxp)
0