結果

問題 No.865 24時間降水量
ユーザー ohreitetsuohreitetsu
提出日時 2019-08-21 22:41:19
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 557 bytes
コンパイル時間 633 ms
コンパイル使用メモリ 70,900 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-18 09:39:52
合計ジャッジ時間 4,603 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,752 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 5 ms
5,376 KB
testcase_06 AC 5 ms
5,376 KB
testcase_07 AC 5 ms
5,376 KB
testcase_08 AC 5 ms
5,376 KB
testcase_09 AC 5 ms
5,376 KB
testcase_10 AC 28 ms
5,376 KB
testcase_11 AC 28 ms
5,376 KB
testcase_12 AC 28 ms
5,376 KB
testcase_13 AC 28 ms
5,376 KB
testcase_14 AC 28 ms
5,376 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
	for (i=2;i<=N-24+1;i++){
		SumA=SumA+A[i+24-1]-A[i-1];
		if (MaxV<SumA){
			MaxV=SumA;
		}
	}
	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;
}
0