結果
| 問題 | No.1104 オンライン点呼 |
| ユーザー |
👑 Nachia
|
| 提出日時 | 2021-01-09 14:05:19 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 436 bytes |
| 記録 | |
| コンパイル時間 | 1,468 ms |
| コンパイル使用メモリ | 209,764 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-16 14:24:27 |
| 合計ジャッジ時間 | 4,412 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 WA * 1 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
int N;
LL K;
LL A[100000],B[100000];
LL D[100000];
int main(){
cin>>N>>K;
rep(i,N) cin>>A[i];
rep(i,N) cin>>B[i];
D[0]=0;
if(N>=2) D[1]=A[0]+B[1];
for(int i=2; i<N; i++) D[i]=min(D[i-1]+A[i-1]+B[i],D[i-2]+A[i-2]+B[i]+K);
LL ans=0; rep(i,N) ans=max(ans,D[i]);
cout<<ans<<endl;
return 0;
}
Nachia