結果

問題 No.865 24時間降水量
ユーザー 👑 tamatotamato
提出日時 2020-03-09 23:14:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 192 ms / 2,000 ms
コード長 554 bytes
コンパイル時間 444 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 106,432 KB
最終ジャッジ日時 2023-08-09 20:45:17
合計ジャッジ時間 4,806 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,168 KB
testcase_01 AC 71 ms
71,404 KB
testcase_02 AC 72 ms
71,272 KB
testcase_03 AC 70 ms
71,344 KB
testcase_04 AC 70 ms
71,556 KB
testcase_05 AC 83 ms
76,724 KB
testcase_06 AC 84 ms
76,760 KB
testcase_07 AC 84 ms
76,700 KB
testcase_08 AC 83 ms
76,496 KB
testcase_09 AC 84 ms
76,948 KB
testcase_10 AC 97 ms
76,640 KB
testcase_11 AC 95 ms
76,768 KB
testcase_12 AC 96 ms
76,768 KB
testcase_13 AC 98 ms
77,852 KB
testcase_14 AC 96 ms
76,812 KB
testcase_15 AC 192 ms
106,408 KB
testcase_16 AC 191 ms
106,432 KB
testcase_17 AC 191 ms
106,404 KB
testcase_18 AC 70 ms
71,468 KB
testcase_19 AC 72 ms
71,264 KB
testcase_20 AC 72 ms
71,032 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