結果
| 問題 |
No.1104 オンライン点呼
|
| ユーザー |
|
| 提出日時 | 2020-07-03 22:03:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 378 bytes |
| コンパイル時間 | 733 ms |
| コンパイル使用メモリ | 67,092 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-17 01:07:46 |
| 合計ジャッジ時間 | 3,125 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 WA * 1 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
7 | main()
| ^~~~
ソースコード
#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;
}