結果

問題 No.1104 オンライン点呼
ユーザー kotatsugamekotatsugame
提出日時 2020-07-04 02:36:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 377 bytes
コンパイル時間 554 ms
コンパイル使用メモリ 66,444 KB
実行使用メモリ 6,484 KB
最終ジャッジ日時 2023-10-17 08:34:56
合計ジャッジ時間 2,881 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,704 KB
testcase_01 AC 83 ms
6,484 KB
testcase_02 AC 77 ms
6,484 KB
testcase_03 AC 55 ms
6,484 KB
testcase_04 AC 2 ms
5,704 KB
testcase_05 AC 2 ms
5,704 KB
testcase_06 AC 2 ms
5,704 KB
testcase_07 AC 32 ms
6,156 KB
testcase_08 AC 14 ms
5,880 KB
testcase_09 AC 32 ms
6,444 KB
testcase_10 AC 2 ms
5,704 KB
testcase_11 AC 22 ms
6,016 KB
testcase_12 AC 34 ms
6,168 KB
testcase_13 AC 29 ms
5,980 KB
testcase_14 AC 4 ms
5,724 KB
testcase_15 AC 47 ms
6,204 KB
testcase_16 WA -
testcase_17 AC 33 ms
6,084 KB
testcase_18 AC 42 ms
6,204 KB
testcase_19 AC 63 ms
6,336 KB
testcase_20 AC 68 ms
6,392 KB
testcase_21 AC 70 ms
6,396 KB
testcase_22 AC 56 ms
6,272 KB
testcase_23 AC 45 ms
6,148 KB
testcase_24 AC 20 ms
5,892 KB
testcase_25 AC 2 ms
5,704 KB
testcase_26 AC 2 ms
5,704 KB
testcase_27 AC 2 ms
5,704 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
int N;
long K,A[1<<17],B[1<<17];
long t[1<<17];
main()
{
	cin>>N>>K;
	for(int i=0;i<N;i++)cin>>A[i];
	for(int i=0;i<N;i++)cin>>B[i];
	t[0]=0;
	long ans=0;
	for(int i=1;i<N;i++)
	{
		t[i]=t[i-1]+A[i-1]+B[i];
		if(i>=2&&t[i]>t[i-2]+A[i-2]+B[i]+K)t[i]=t[i-2]+A[i-2]+B[i]+K;
		if(ans<t[i])ans=t[i];
	}
	cout<<ans<<endl;
}
0