結果

問題 No.865 24時間降水量
ユーザー IKyoproIKyopro
提出日時 2019-08-16 21:42:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 473 ms / 2,000 ms
コード長 674 bytes
コンパイル時間 699 ms
コンパイル使用メモリ 60,544 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-23 22:09:13
合計ジャッジ時間 3,479 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 4 ms
4,348 KB
testcase_06 AC 4 ms
4,348 KB
testcase_07 AC 4 ms
4,348 KB
testcase_08 AC 4 ms
4,348 KB
testcase_09 AC 4 ms
4,348 KB
testcase_10 AC 23 ms
4,348 KB
testcase_11 AC 23 ms
4,348 KB
testcase_12 AC 23 ms
4,348 KB
testcase_13 AC 23 ms
4,348 KB
testcase_14 AC 23 ms
4,348 KB
testcase_15 AC 470 ms
4,348 KB
testcase_16 AC 473 ms
4,348 KB
testcase_17 AC 468 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> A(N+1);
    int ma = 0;
    for(int i=1;i<=N;i++){
        cin >> A[i];
    }
    for(int i=1;i+23<=N;i++){
        int val = 0;
        for(int j=0;j<24;j++){
            val += A[i+j];
        }
        ma = max(ma,val);
    }
    int Q;
    cin >> Q;
    for(int q=0;q<Q;q++){
        int t,v;
        cin >> t >> v;
        A[t] = v;
        for(int i=t-23;i<=t;i++){
            if(i<1 || i+23>N) continue;
            int val = 0;
            for(int j=0;j<24;j++) val += A[i+j];
            ma = max(ma,val);
        }
        cout << ma << endl;
    }
}
0