結果
問題 | No.865 24時間降水量 |
ユーザー |
|
提出日時 | 2020-07-10 20:55:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 90 ms / 2,000 ms |
コード長 | 568 bytes |
コンパイル時間 | 2,196 ms |
コンパイル使用メモリ | 193,912 KB |
最終ジャッジ日時 | 2025-01-11 17:32:53 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | int n; scanf("%d",&n); | ~~~~~^~~~~~~~~ main.cpp:10:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | rep(i,n) scanf("%d",&a[i]); | ~~~~~^~~~~~~~~~~~ main.cpp:25:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 25 | int q; scanf("%d",&q); | ~~~~~^~~~~~~~~ main.cpp:27:31: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 27 | int t,v; scanf("%d%d",&t,&v); t--; | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; int main(){ int n; scanf("%d",&n); vector<int> a(n); rep(i,n) scanf("%d",&a[i]); vector<int> b(n-23); { int sum=0; rep(i,23) sum+=a[i]; for(int i=23;i<n;i++){ sum+=a[i]; b[i-23]=sum; sum-=a[i-23]; } } int ans=*max_element(b.begin(),b.end()); int q; scanf("%d",&q); rep(_,q){ int t,v; scanf("%d%d",&t,&v); t--; for(int i=max(t-23,0);i<min(t+1,n-23);i++){ b[i]+=v-a[t]; ans=max(ans,b[i]); } a[t]=v; printf("%d\n",ans); } return 0; }