結果

問題 No.865 24時間降水量
ユーザー tamatotamato
提出日時 2020-03-09 23:14:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 193 ms / 2,000 ms
コード長 554 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 82,220 KB
実行使用メモリ 105,420 KB
最終ジャッジ日時 2024-04-27 15:16:05
合計ジャッジ時間 3,378 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,000 KB
testcase_01 AC 38 ms
53,068 KB
testcase_02 AC 38 ms
53,088 KB
testcase_03 AC 39 ms
52,608 KB
testcase_04 AC 40 ms
52,828 KB
testcase_05 AC 52 ms
63,376 KB
testcase_06 AC 51 ms
63,152 KB
testcase_07 AC 51 ms
63,892 KB
testcase_08 AC 50 ms
63,696 KB
testcase_09 AC 51 ms
63,676 KB
testcase_10 AC 64 ms
71,568 KB
testcase_11 AC 66 ms
73,364 KB
testcase_12 AC 66 ms
72,964 KB
testcase_13 AC 71 ms
75,904 KB
testcase_14 AC 65 ms
72,884 KB
testcase_15 AC 180 ms
105,420 KB
testcase_16 AC 184 ms
105,228 KB
testcase_17 AC 193 ms
105,408 KB
testcase_18 AC 44 ms
52,816 KB
testcase_19 AC 41 ms
53,036 KB
testcase_20 AC 41 ms
52,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.buffer.readline

    N = int(input())
    A = list(map(int, input().split()))
    B = [0] * (N-24+1)
    B[0] = sum(A[:24])
    for i in range(1, len(B)):
        B[i] = B[i-1] + A[i+24-1] - A[i-1]
    M = max(B)
    for _ in range(int(input())):
        t, v = map(int, input().split())
        t -= 1
        d = v - A[t]
        A[t] = v
        for i in range(max(0, t - 23), min(N-23, t+1)):
            B[i] += d
            M = max(M, B[i])
        print(M)


if __name__ == '__main__':
    main()
0