結果

問題 No.865 24時間降水量
ユーザー Ta910Ta910
提出日時 2019-08-16 22:24:59
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 736 bytes
コンパイル時間 2,701 ms
コンパイル使用メモリ 206,776 KB
実行使用メモリ 11,748 KB
最終ジャッジ日時 2023-10-24 01:12:53
合計ジャッジ時間 7,455 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,348 KB
testcase_02 WA -
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 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>

using namespace std;

int main(void){
    int N,Q;
    cin>>N;
    VI A(N),S(N-23);
    rep(i,N)cin>>A[i];
    rep(i,24)S[0]+=A[i];
    for(int i=1;i<N-23;i++){
        S[i]=S[i-1]+A[i+23]-A[i-1];
    }
    cin>>Q;
    VI T(Q),V(Q),ans(Q);
    rep(i,Q){
        cin>>T[i]>>V[i];
        int s=max(0,T[i]-24);
        int e;
        if(s==0)e=min(T[i],N-23);
        else e=min(s+24,N-23);
        for(int j=s;j<e;j++){
            S[j]+=V[i]-A[T[i]-1];
        }
        sort(S.begin(),S.end());
        ans[i]=S[N-24];
    }
    rep(i,Q)cout<<ans[i]<<endl;
    //rep(i,N-23)cout<<S[i]<<endl;
    
}

0