結果

問題 No.865 24時間降水量
ユーザー ohreitetsuohreitetsu
提出日時 2019-08-21 22:25:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 568 bytes
コンパイル時間 702 ms
コンパイル使用メモリ 71,876 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-07-31 08:46:48
合計ジャッジ時間 5,648 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
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;
	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;
}
0