結果
| 問題 |
No.865 24時間降水量
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2019-08-16 21:31:33 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 93 ms / 2,000 ms |
| コード長 | 659 bytes |
| コンパイル時間 | 1,468 ms |
| コンパイル使用メモリ | 168,968 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 15:07:10 |
| 合計ジャッジ時間 | 2,750 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
#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';
}
}
risujiroh