题库练习 Careful Maneuvering
← 上一题 下一题 →

A11792 | Careful Maneuvering

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer $y$ -coordinates, and their $x$ -coordinate is equal to $-100$ , while the second group is positioned in such a way that they all have integer $y$ -coordinates, and their $x$ -coordinate is equal to $100$ .

Each spaceship in both groups will simultaneously shoot two laser shots (infinite ray that destroys any spaceship it touches), one towards each of the small spaceships, all at the same time. The small spaceships will be able to avoid all the laser shots, and now want to position themselves at some locations with $x=0$ (with not necessarily integer $y$ -coordinates), such that the rays shot at them would destroy as many of the enemy spaceships as possible. Find the largest numbers of spaceships that can be destroyed this way, assuming that the enemy spaceships can't avoid laser shots.

输入格式

The first line contains two integers $n$ and $m$ ( $1 \le n, m \le 60$ ), the number of enemy spaceships with $x = -100$ and the number of enemy spaceships with $x = 100$ , respectively.

The second line contains $n$ integers $y_{1,1}, y_{1,2}, \ldots, y_{1,n}$ ( $|y_{1,i}| \le 10\,000$ ) — the $y$ -coordinates of the spaceships in the first group.

The third line contains $m$ integers $y_{2,1}, y_{2,2}, \ldots, y_{2,m}$ ( $|y_{2,i}| \le 10\,000$ ) — the $y$ -coordinates of the spaceships in the second group.

The $y$ coordinates are not guaranteed to be unique, even within a group.

输出格式

Print a single integer – the largest number of enemy spaceships that can be destroyed.

输入输出样例

输入 #1
3 9
1 2 3
1 2 3 7 8 9 11 12 13
输出 #1
9
输入 #2
5 5
1 2 3 4 5
1 2 3 4 5
输出 #2
10
C++ 编辑器
输入
输出