結果

問題 No.865 24時間降水量
ユーザー Y17Y17
提出日時 2019-08-16 23:38:10
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 425 ms / 2,000 ms
コード長 739 bytes
コンパイル時間 2,677 ms
コンパイル使用メモリ 160,016 KB
実行使用メモリ 6,736 KB
最終ジャッジ日時 2023-10-24 06:32:34
合計ジャッジ時間 5,206 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,736 KB
testcase_01 AC 4 ms
6,736 KB
testcase_02 AC 3 ms
6,736 KB
testcase_03 AC 4 ms
6,736 KB
testcase_04 AC 3 ms
6,736 KB
testcase_05 AC 6 ms
6,736 KB
testcase_06 AC 5 ms
6,736 KB
testcase_07 AC 6 ms
6,736 KB
testcase_08 AC 6 ms
6,736 KB
testcase_09 AC 5 ms
6,736 KB
testcase_10 AC 22 ms
6,736 KB
testcase_11 AC 23 ms
6,736 KB
testcase_12 AC 22 ms
6,736 KB
testcase_13 AC 22 ms
6,736 KB
testcase_14 AC 22 ms
6,736 KB
testcase_15 AC 416 ms
6,736 KB
testcase_16 AC 418 ms
6,736 KB
testcase_17 AC 425 ms
6,736 KB
testcase_18 AC 4 ms
6,736 KB
testcase_19 AC 3 ms
6,736 KB
testcase_20 AC 4 ms
6,736 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