結果

問題 No.865 24時間降水量
ユーザー Alex WiceAlex Wice
提出日時 2019-08-16 22:53:50
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 793 bytes
コンパイル時間 1,871 ms
コンパイル使用メモリ 77,176 KB
実行使用メモリ 118,700 KB
最終ジャッジ日時 2023-10-24 03:16:00
合計ジャッジ時間 5,269 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
75,924 KB
testcase_01 AC 72 ms
75,924 KB
testcase_02 AC 72 ms
75,924 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 73 ms
76,204 KB
testcase_19 AC 74 ms
76,204 KB
testcase_20 AC 72 ms
76,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(N, A, Q, queries):
    # max of 24 hours
    # queries (A[i] [1indexed] += V1)
    ans = [0] * (N-24 + 1)
    S = sum(A[i] for i in xrange(24))
    for i in xrange(24, N):
        ans[i-24] = S
        S += A[i] - A[i-24]
    ans[N-24] = S
    best = max(ans)
    fans = []

    for i, x in queries:
        i -= 1
        left = max(0, i - 24)
        right = min(len(ans) - 1, i)
        v = max(x, A[i]) - A[i]
        A[i] += v
        for j in xrange(left, right + 1):
            ans[j] += v
            best = max(best, ans[j])

        fans.append(best)
    return fans
        

N = int(raw_input())
A = map(int, raw_input().split())
Q = int(raw_input())
queries = [map(int, raw_input().split()) for _ in xrange(Q)]

ans = solve(N, A, Q, queries)
for x in ans:
    print x
0