Under construction

Still being built. Things may change

Array Sum

Interview

Time limit5sMemory limit512 MB

Summary
Reorder two arrays to make some sum value repeat as often as possible; report the maximum repeat count and the largest such sum.
Level

Medium6 of 10

Topics
Sorting, Hash map, Greedy
Solved
No attempts yet

Problem

You are given an array AA and an array BB, each of size NN.

You can shuffle the elements of AA and the elements of BB into any order you like. After shuffling, build the array CC by C[i]=A[i]+B[i]C[i] = A[i] + B[i].

Let YY be the number that appears most often in CC, and let XX be how many times it appears. Build CC so that XX is as large as possible. If several ways of building CC reach the same largest XX, pick the one whose YY is largest.

Input

The first line contains the array size NN (3≤N≤1000003 \le N \le 100000).

The second line contains the NN elements of AA, and the third line contains the NN elements of BB, separated by spaces.

Every element of both arrays is an integer that is at least 00 and less than 100000100000.

Output

Print XX and YY on one line, separated by a space.

Examples3

  1. Example 1

    Input
    3
    1 1 1
    1 1 1
    
    Expected output
    3 2
    
  2. Example 2

    Input
    3
    1 1 3
    1 1 3
    
    Expected output
    2 4
    
  3. Example 3

    Input
    3
    1 2 1
    0 1 1
    
    Expected output
    3 2