cswork / OAOpen practice workspace

CiscoOA #23

Find Maximum Number Drop Points Connected

Estimated EasyJudge-ready

Topics (AI-labelled)Hashing

Choose one horizontal or vertical straight line; directions cannot be mixed, and diagonal lines cannot be chosen. The line must cover at least two input points; output the maximum number of points covered, or 0 if this is impossible. Duplicate coordinates are counted as many times as they are recorded in the input.

Input

The input is n, then n x-coordinates and n y-coordinates. The original bound 2≤n≤700 is recovered from the complete supplementary raw; coordinates have no original numeric bound, and this site adds −10^9..10^9. The truncated main raw is recovered from a complete raw of the same problem; another version with a diagonal example 5 conflicts with its own rules and is not adopted.

Output

Output a single integer, the answer.

Example 1

Input:

5
2 3 2 4 2
2 2 6 5 8

Output:

3

Example 2

Input:

2
1 2
1 2

Output:

0

Example 3

Input:

2
1 3
2 2

Output:

2

Example notes

The outputs of the three public examples are, in order: 3; 0; 2. Verified by independent enumeration or direct simulation.

Editorial

Loading solution…