結果

問題 No.865 24時間降水量
ユーザー titiatitia
提出日時 2019-08-17 03:33:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 418 ms / 2,000 ms
コード長 467 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 81,732 KB
実行使用メモリ 105,160 KB
最終ジャッジ日時 2023-10-24 23:04:15
合計ジャッジ時間 3,843 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,480 KB
testcase_01 AC 36 ms
53,480 KB
testcase_02 AC 37 ms
53,480 KB
testcase_03 AC 36 ms
53,480 KB
testcase_04 AC 38 ms
53,480 KB
testcase_05 AC 73 ms
72,664 KB
testcase_06 AC 74 ms
72,664 KB
testcase_07 AC 70 ms
72,664 KB
testcase_08 AC 71 ms
72,664 KB
testcase_09 AC 72 ms
72,932 KB
testcase_10 AC 123 ms
77,552 KB
testcase_11 AC 119 ms
77,500 KB
testcase_12 AC 118 ms
77,508 KB
testcase_13 AC 129 ms
77,764 KB
testcase_14 AC 120 ms
77,552 KB
testcase_15 AC 418 ms
105,160 KB
testcase_16 AC 418 ms
105,160 KB
testcase_17 AC 412 ms
105,160 KB
testcase_18 AC 36 ms
53,480 KB
testcase_19 AC 36 ms
53,480 KB
testcase_20 AC 36 ms
53,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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=S
for 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=S
    for i in range(from_q,min(q+25,N)):
        S+=A[i]-A[i-24]
        MAX=max(MAX,S)

    return MAX

for t,v in Query:
    A[t-1]=v
    MAX=max(MAX,MAX_from_i(t-1))

    print(MAX)
0