結果

問題 No.865 24時間降水量
ユーザー betrue12
提出日時 2019-08-16 21:39:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 415 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 1,580 ms
コンパイル使用メモリ 169,048 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 15:21:32
合計ジャッジ時間 3,865 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    vector<int> S(N+24);
    for(int i=0; i<N; i++) for(int j=0; j<24; j++) S[i+j] += A[i];
    int Q;
    cin >> Q;
    int mx = *max_element(S.begin(), S.end());
    while(Q--){
        int t, v;
        cin >> t >> v;
        t--;
        for(int j=0; j<24; j++){
            S[t+j] += v - A[t];
            mx = max(mx, S[t+j]);
        }
        A[t] = v;
        cout << mx << endl;
    }
    return 0;
}
0