PK
~J J main.cpp#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> b(n+1);
vector<int> ba(n+1);
vector<int> bab(n+1);
vector<int> baru(n+1);
vector<int> aaru(n+1);
b[0]=0;
ba[0]=0;
bab[0]=0;
for(int i=1;i<n+1;i++){
cin >> aaru[i];
}
for(int i=1;i<n+1;i++){
cin >> baru[i];
}
for(int i=1;i<n+1;i++){
b[i]=b[i-1]+baru[i];
ba[i]=min(ba[i-1],b[i-1])+aaru[i];
bab[i]=min(bab[i-1],ba[i-1])+baru[i];
}
cout << min(b[n],min(ba[n],bab[n])) << endl;
return 0;
}
PK
~p p main.oELF >