結果

問題 No.865 24時間降水量
ユーザー kohei2019kohei2019
提出日時 2022-05-04 14:01:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,568 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 105,272 KB
最終ジャッジ日時 2023-09-16 16:39:20
合計ジャッジ時間 8,283 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
75,248 KB
testcase_01 AC 71 ms
75,316 KB
testcase_02 AC 72 ms
75,196 KB
testcase_03 AC 75 ms
75,248 KB
testcase_04 AC 69 ms
75,412 KB
testcase_05 AC 110 ms
77,584 KB
testcase_06 AC 112 ms
77,444 KB
testcase_07 AC 110 ms
77,692 KB
testcase_08 AC 110 ms
77,812 KB
testcase_09 AC 116 ms
77,708 KB
testcase_10 AC 197 ms
79,244 KB
testcase_11 AC 191 ms
79,296 KB
testcase_12 AC 192 ms
78,948 KB
testcase_13 AC 189 ms
78,876 KB
testcase_14 AC 192 ms
78,860 KB
testcase_15 AC 1,568 ms
105,184 KB
testcase_16 AC 1,529 ms
105,272 KB
testcase_17 AC 1,542 ms
105,168 KB
testcase_18 AC 68 ms
71,420 KB
testcase_19 AC 71 ms
75,284 KB
testcase_20 AC 70 ms
75,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
lsA = list(map(int,input().split()))
Q = int(input())
lsTV = []
for i in range(Q):
    t,v = map(int,input().split())
    lsTV.append((t-1,v))
maxp = 0
for i in range(N-23):
    maxp = max(maxp,sum(lsA[i:i+24]))

for i in range(Q):
    t,v = lsTV[i]
    l,r = max(0,t-24),t+24
    lsA[t] = v
    for j in range(l,r):
        sm = sum(lsA[j:j+24])
        if maxp < sm:
            maxp = sm
    print(maxp)
0