結果
問題 | No.865 24時間降水量 |
ユーザー |
![]() |
提出日時 | 2019-08-16 22:11:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 66 ms / 2,000 ms |
コード長 | 888 bytes |
コンパイル時間 | 937 ms |
コンパイル使用メモリ | 76,276 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 17:05:15 |
合計ジャッジ時間 | 1,904 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include <iostream>#include <vector>#include <string>#include <algorithm>#include <cstdio>#include <cstring>#include <cmath>using namespace std;using ll = long long;int main() {ios::sync_with_stdio(false);cin.tie(0);int n;cin >> n;vector<int> a(n), s(n);for (int i = 0; i < n; i++) {cin >> a[i];}int t = 0, m = 0;for (int i = 0; i < n; i++) {if (i < 24) {t += a[i];} else {t += a[i] - a[i - 24];}s[i] = t;m = max(m, t);}int q;cin >> q;for (int h = 0; h < q; h++) {int t, v;cin >> t >> v;t--;int d = v - a[t];a[t] = v;for (int i = t; i < min(t + 24, n); i++) {s[i] += d;m = max(m, s[i]);}cout << m << '\n';}return 0;}