結果

問題 No.865 24時間降水量
ユーザー Y17Y17
提出日時 2019-08-16 23:38:10
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 346 ms / 2,000 ms
コード長 739 bytes
コンパイル時間 1,339 ms
使用メモリ 6,528 KB
最終ジャッジ日時 2022-11-22 14:55:54
合計ジャッジ時間 3,806 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 2 ms
5,004 KB
testcase_01 AC 3 ms
5,060 KB
testcase_02 AC 3 ms
5,060 KB
testcase_03 AC 2 ms
5,092 KB
testcase_04 AC 2 ms
5,036 KB
testcase_05 AC 4 ms
4,972 KB
testcase_06 AC 3 ms
5,032 KB
testcase_07 AC 3 ms
4,912 KB
testcase_08 AC 3 ms
5,088 KB
testcase_09 AC 4 ms
5,044 KB
testcase_10 AC 15 ms
5,100 KB
testcase_11 AC 16 ms
5,012 KB
testcase_12 AC 16 ms
4,972 KB
testcase_13 AC 15 ms
4,992 KB
testcase_14 AC 17 ms
4,916 KB
testcase_15 AC 342 ms
6,468 KB
testcase_16 AC 346 ms
6,528 KB
testcase_17 AC 323 ms
6,492 KB
testcase_18 AC 2 ms
5,088 KB
testcase_19 AC 2 ms
4,908 KB
testcase_20 AC 2 ms
5,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int long long

signed main(){
    int n;
    cin >> n;
    int a[200010];
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }

    int b[200010] = {};

    int ma = 0;
    for(int i = 0;i <= n-24;i++){
        for(int j = 0;j < 24;j++){
            b[i] += a[i+j];
        }
        ma = max(ma, b[i]);
    }

    int q;
    cin >> q;

    for(int p = 0;p < q;p++){
        int t, v;
        cin >> t >> v;
        t--;
        int d = v-a[t];

        a[t] = v;

        for(int i = max(0ll, t-23);i <= t;i++){
            if(i+24 <= n){
                b[i] += d;
                ma = max(ma, b[i]);
            }
        }
        cout << ma << endl;
    }

    return 0;
}


0