//#include //using namespace atcoder; #include using namespace std; typedef long long ll; #define REP(i, n) for(int i=0; i=0; i--) #define FOR(i, m, n) for(int i=m; i; using vvi = vector>; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const int INF = 2e9; const ll LINF = (1LL<<60); int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector

ab(n); REP(i,n) cin >> ab[i].first; REP(i,n) cin >> ab[i].second; sort(ALL(ab)); double k; if(n&1) k = ab[n/2].first; else k = double(ab[n/2-1].first + ab[n/2].first)/2; double f = 0; REP(i,n) f += abs(k - ab[i].first) * ab[i].second; cout << k << " " << f << endl; return 0; }