結果

問題 No.865 24時間降水量
ユーザー 👑 rin204rin204
提出日時 2022-07-10 17:31:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 990 ms / 2,000 ms
コード長 471 bytes
コンパイル時間 814 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 105,712 KB
最終ジャッジ日時 2023-09-02 00:32:22
合計ジャッジ時間 8,394 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
75,660 KB
testcase_01 AC 74 ms
75,832 KB
testcase_02 AC 75 ms
75,740 KB
testcase_03 AC 78 ms
75,720 KB
testcase_04 AC 73 ms
75,920 KB
testcase_05 AC 100 ms
76,860 KB
testcase_06 AC 98 ms
76,924 KB
testcase_07 AC 108 ms
78,792 KB
testcase_08 AC 97 ms
77,172 KB
testcase_09 AC 107 ms
77,868 KB
testcase_10 AC 157 ms
77,960 KB
testcase_11 AC 159 ms
78,600 KB
testcase_12 AC 155 ms
78,728 KB
testcase_13 AC 171 ms
78,736 KB
testcase_14 AC 159 ms
78,412 KB
testcase_15 AC 965 ms
105,712 KB
testcase_16 AC 980 ms
105,492 KB
testcase_17 AC 990 ms
105,644 KB
testcase_18 AC 70 ms
71,148 KB
testcase_19 AC 72 ms
71,256 KB
testcase_20 AC 74 ms
75,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(23, n):
    tot = 0
    for j in range(i - 23, i + 1):
        tot += A[j]
    ans = max(ans, tot)

Q = int(input())
for _ in range(Q):
    t, v = map(int, input().split())
    t -= 1
    A[t] = v
    mi = max(0, t - 23)
    ma = min(t, n - 24)
    for i in range(mi, ma + 1):
        tot = 0
        for j in range(i, i + 24):
            tot += A[j]
        ans = max(ans, tot)
    print(ans)
0