Fake Photo

TimeLimit:4000MS  MemoryLimit:524288KB
64-bit integer IO format:%I64d
Special Judge
未提交 | 登录后收藏
Problem Description
Zhang3 has made a fake photo by Photoshop, and published it on the Internet.

However, there are $n$ watches in the photo, showing different times. We assume that every watch has two hands: the hour hand and the minute hand, both moves at a uniform speed.

Someone pointed out the problem of the watches. Then everyone began to doubt that it's a fake photo. To respond, Zhang3 will announce that the photo is taken at time $x$, which is a time in a day. By choosing $x$ perfectly, she can make all of the watches look like showing time $x$, with a small error. For example, if there are two watches showing $\text{12:30:00}$ and $\text{02:40:00}$ respectively, she can choose $x = \text{01:35:00}$ as if both watches are showing time $x$.

Specifically, we define the error of a hand of a watch as the angle between its actual location and its ideal location, where the ideal location is the correct location to show time $x$. In the example above, the first watch shows $\text{12:30:00}$ and $x = \text{01:35:00}$, so the minute hand has an error of $30^\circ$ while the error of the hour hand is a little bit larger.

Please help Zhang3 choose such $x$ that the maximum error among all of the $2n$ hands is minimized. $x$ doesn't need to be an integer in seconds. Print the optimal error in degrees.
Input
The first line of the input gives the number of test cases $T \; (1 \le T \le 100)$. $T$ test cases follow.

For each test case, the first line contains an integer $n \; (1 \le n \le 5 \times 10^4)$, the number of watches.

Then $n$ lines follow, the $i^\mathrm{th}$ of which contains a string of format $\text{HH:MM:SS} \; (0 \le \text{HH} \le 23, 0 \le \text{MM, SS} \le 59)$, describing the time the $i^\mathrm{th}$ watch is showing.

The sum of $n$ in all test cases doesn't exceed $10^5$.
Output
For each test case, print a line with a real number $\alpha \; (0 \le \alpha \le 180)$, representing the answer is $\alpha ^\circ$.

Your answers should have absolute or relative errors of at most $10^{-6}$.
SampleInput
2
2
12:30:00
02:40:00
3
00:00:00
23:59:59
06:30:30
SampleOutput
32.5
91.55
Submit
题目统计信息详细
总AC数0
通过人数0
尝试人数0
总提交量0
AC率0.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: