思路
卡车从 出发,需在 后经过 ,最后返回到 。最短时间为 。
最终时间复杂度 。
代码
#include<bits/stdc++.h>
using namespace std;
#define int long long
int x[11451],t[11451];
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int n;
cin>>n;
for(int i=1;i<=n;i++)cin>>x[i];
for(int i=1;i<=n;i++)cin>>t[i];
int ans=2*x[n];
for(int i=1;i<=n;i++)
ans=max(ans,t[i]+x[i]);
cout<<ans;
return 0;
}