結果

問題 No.865 24時間降水量
ユーザー Alex WiceAlex Wice
提出日時 2019-08-16 22:48:23
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 748 bytes
コンパイル時間 1,007 ms
コンパイル使用メモリ 77,344 KB
実行使用メモリ 118,696 KB
最終ジャッジ日時 2023-10-24 02:23:13
合計ジャッジ時間 5,226 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
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 77 ms
76,216 KB
testcase_19 WA -
testcase_20 AC 75 ms
76,216 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, v in queries:
        i -= 1
        left = max(0, i - 24)
        right = min(len(ans) - 1, i + 23)
        for j in xrange(left, right):
            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