| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 43 | 30 | 15 | 53.571% |
An old watchmaker has $n$ stopped nano alarm-clocks numbered with integers from 1ドル$ to $n$. Nano alarm-clocks count time in hours, and in one hour there are million minutes, each minute lasting a million seconds. In order to repair them all the watchmaker should synchronize the time on all nano alarm-clocks. In order to do this he moves clock hands a certain time forward (may be zero time). Let’s name this time shift a transfer time.
Your task is to calculate the minimal total transfer time required for all nano alarm-clocks to show the same time.
The first line contains a single integer $n$ --- the number of nano alarm-clocks (2ドル \le n \le 10^5$). In each $i$-th of the next $n$ lines the time $h,ドル $m,ドル $s,ドル shown on the $i$-th clock. Integers $h,ドル $m$ and $s$ show the number of hours, minutes and seconds respectively. (0ドル \le h < 12,ドル 0ドル \le m < 10^6,ドル 0ドル \le s < 10^6$).
Output three integers separated with spaces $h,ドル $m$ and $s$ --- total minimal transfer time, where $h,ドル $m$ and $s$ --- number of hours, minutes and seconds respectively (0ドル \le m < 10^6,ドル 0ドル \le s < 10^6$).
2 10 0 0 3 0 0
5 0 0
3 11 999999 999999 0 0 0 11 999999 999999
0 0 2