結果

問題 No.865 24時間降水量
ユーザー mint6421mint6421
提出日時 2019-08-18 17:48:42
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,227 bytes
コンパイル時間 1,527 ms
コンパイル使用メモリ 162,720 KB
実行使用メモリ 6,952 KB
最終ジャッジ日時 2024-04-09 02:18:45
合計ジャッジ時間 4,154 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>

int n;
int a[200100];
int b[200100];

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin>>n;
  rep(i,n){
    cin>>a[i+1];
  }

  FOR(i,1,n+1){
    b[i]=a[i]+b[i-1];
  }

  rep(i,n+1){
    //cout<<b[i]<<' ';
  }
  //cout<<endl;

  int ans=0;
  FOR(i,24,n+1){
    ans=max(ans,b[i]-b[i-24]);
  }

  int q;
  cin>>q;
  while(q--){
    int t,v;
    cin>>t>>v;
    FOR(i,t,t+24){
      if(i>n) break;
      b[i]+=v-a[t];
    }
    FOR(i,t,t+24){
      if(i>n) break;
      if(i-24<0) continue;
      ans=max(ans,b[i]-b[i-24]);
    }
    a[t]=v;
    cout<<ans<<endl;
  }




}
0