题意描述
思路
AC代码
代码语言:javascript
复制#include<bits/stdc .h>
#define x first
#define y second
#define PB push_back
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) begin(a),end(a)
#define rep(x,l,u) for(ll x=l;x<u;x )
#define rrep(x,l,u) for(ll x=l;x>=u;x--)
#define sz(x) x.size()
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<long,long> PLL;
typedef pair<char,char> PCC;
typedef long long ll;
const int N=3*1e5 10;
const int M=1e6 10;
const int INF=0x3f3f3f3f;
const int MOD=1e9 7;
ll a[N],b[N],f[N][2];
void solve(){
mst(f,INF);
int n,c;cin>>n>>c;
rep(i,1,n) cin>>a[i];
rep(i,1,n) cin>>b[i];
f[1][0]=0;
f[1][1]=c;
rep(i,2,n 1){
f[i][0]=min(f[i-1][0] a[i-1],f[i-1][1] a[i-1]);
f[i][1]=min(f[i-1][0] b[i-1] c,f[i-1][1] b[i-1]);
}
rep(i,1,n 1) cout<<min(f[i][1],f[i][0])<<' ';
}
int main(){
//IOS;
//int t;cin>>t;
//while(t--)
solve();
return 0;
}