結果

問題 No.865 24時間降水量
ユーザー Y17Y17
提出日時 2019-08-16 23:29:12
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 700 bytes
コンパイル時間 1,569 ms
コンパイル使用メモリ 160,112 KB
実行使用メモリ 6,804 KB
最終ジャッジ日時 2023-10-24 05:55:00
合計ジャッジ時間 4,180 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,752 KB
testcase_01 AC 4 ms
6,752 KB
testcase_02 AC 4 ms
6,752 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 4 ms
6,752 KB
testcase_19 AC 4 ms
6,752 KB
testcase_20 AC 4 ms
6,752 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-24);i <= min(t, n-24);i++){
            b[i] += d;
            ma = max(ma, b[i]);
        }
        cout << ma << endl;
    }

    return 0;
}

0