贪心地让最大和最小匹配即可
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1000005;
int n,a[N],b[N];
signed main() {
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i];
for(int i=1;i<=n;i++) cin>>b[i];
sort(a+1,a+n+1);
sort(b+1,b+n+1);
reverse(b+1,b+n+1);
int ans=0;
for(int i=1;i<=n;i++) ans=max(ans,a[i]+b[i]);
cout<<ans;
}