結果
問題 | No.865 24時間降水量 |
ユーザー |
|
提出日時 | 2019-08-21 22:25:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 568 bytes |
コンパイル時間 | 716 ms |
コンパイル使用メモリ | 71,572 KB |
実行使用メモリ | 13,640 KB |
最終ジャッジ日時 | 2024-10-10 02:32:25 |
合計ジャッジ時間 | 5,217 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | WA * 15 TLE * 1 -- * 2 |
ソースコード
#include <iostream> #include <vector> using namespace std; int N; vector<int> A; int GetMax(vector<int> &A) { int i; int MaxV=0,SumA=0; for (i=1;i<=24;i++){ SumA+=A[i]; } MaxV=SumA; int maxV; for (i=2;i<=N-24+1;i++){ maxV=SumA+A[i+24-1]-A[i-1]; if (MaxV<maxV){ MaxV=maxV; } } return MaxV; } int main(int argc, char* argv[]) { int i; cin>>N; int X; vector<int> A; A.push_back(0); for (i=1;i<=N;i++){ cin>>X; A.push_back(X); } int Q; cin>>Q; int T,V; for (i=1;i<=Q;i++){ cin>>T>>V; A[T]=V; cout<<GetMax(A)<<endl; } return 0; }