結果

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

ソースコード

diff #

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