#include #include #include #include #include #include #include using namespace std; #define int long long #define endl "\n" constexpr long long INF = (long long)1e18; constexpr long long MOD = 1'000'000'007; struct fast_io { fast_io(){ std::cin.tie(nullptr); std::ios::sync_with_stdio(false); }; } fio; #define A second #define B first signed main(){ cout<> in; cin>>N; in.resize(N); for(int i = 0; i < N; i++){ cin>>in[i].A; } for(int i = 0; i < N; i++){ cin>>in[i].B; // in[i].B *= 2; n += in[i].B; } sort(in.begin(), in.end()); // cout<<"n = "<= med) { X = in[i].A; break; } } for(int i = 0; i < N; i++){ sum2 += in[i].B; if(sum2 >= med2) { X2 = in[i].A; break; } } X = (X + X2); for(int i = 0; i < N; i++){ // cout<<"A = "<