TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

You are given two disjoint sets of dots with their coordinates in the Cartesian coordinate
system, one set of red dots and one set of blue dots. You need to calculate the maximum
distance between two dots (one red and one blue).

Input Format

The first line of the input contains an integer T, indicates the number of test cases.

The first line of each test case contains one positive integer N (1<=N<=100000) representing the number of red dots. Each of the next N lines contain two space-separated integers representing the coordinates of a red dot. The next line of the input contains one integer M (1<=M<=100000), the number of blue dots. Finally the next M lines contain two space-separated integers representing the coordinates of the blue dots. Each coordinate will be in the interval [-109, 109].

Output Format

For each test case please output one line containing the maximum distance between one red and one blue dot with 3 decimal point precision.

Sample Input 1

1
5
1 1
3 3
5 4
4 2
5 7
6
2 1
3 4
3 2
2 3
1 2
2 5

Sample Output 1

6.708

Hints

Problem Source

Migrated from old NTUJ.

MIT Individual 2009

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 524288 200