結果

問題 No.865 24時間降水量
ユーザー risujirohrisujiroh
提出日時 2019-08-16 21:31:33
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 1,589 ms
使用メモリ 3,960 KB
最終ジャッジ日時 2022-11-22 03:44:53
合計ジャッジ時間 3,309 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,516 KB
testcase_01 AC 2 ms
3,388 KB
testcase_02 AC 1 ms
3,488 KB
testcase_03 AC 1 ms
3,516 KB
testcase_04 AC 2 ms
3,400 KB
testcase_05 AC 2 ms
3,396 KB
testcase_06 AC 2 ms
3,500 KB
testcase_07 AC 2 ms
3,408 KB
testcase_08 AC 2 ms
3,500 KB
testcase_09 AC 2 ms
3,556 KB
testcase_10 AC 6 ms
3,408 KB
testcase_11 AC 6 ms
3,508 KB
testcase_12 AC 6 ms
3,468 KB
testcase_13 AC 7 ms
3,400 KB
testcase_14 AC 6 ms
3,476 KB
testcase_15 AC 109 ms
3,896 KB
testcase_16 AC 109 ms
3,960 KB
testcase_17 AC 108 ms
3,776 KB
testcase_18 AC 2 ms
3,424 KB
testcase_19 AC 2 ms
3,440 KB
testcase_20 AC 2 ms
3,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  V<> a(n); for (auto&& e : a) cin >> e;
  int q; cin >> q;
  int res = 0;
  for (int i = 0; i + 24 <= n; ++i) {
    res = max(res, accumulate(begin(a) + i, begin(a) + i + 24, 0));
  }
  while (q--) {
    int t, x; cin >> t >> x, --t;
    a[t] = x;
    for (int i = max(t - 23, 0); i <= min(t, n - 24); ++i) {
      res = max(res, accumulate(begin(a) + i, begin(a) + i + 24, 0));
    }
    cout << res << '\n';
  }
}
0