結果
問題 |
No.1104 オンライン点呼
|
ユーザー |
👑 ![]() |
提出日時 | 2021-01-09 14:08:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 432 bytes |
コンパイル時間 | 2,021 ms |
コンパイル使用メモリ | 191,092 KB |
最終ジャッジ日時 | 2025-01-17 15:38:00 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 5 WA * 20 |
ソースコード
#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=min(D[N-1],D[max(0,N-2)]); cout<<ans<<endl; return 0; }