时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
At that moment the bad news came: After Groundhog set out for
seconds,
Orange took his temperature, and it turned out to be 41℃ !!! In addition to grief and indignation, Orange decided to run to Groundhog, to tell him the news at the speed of
.
Groundhog had to run, of course, but he was running too slow at

. As he ran, he had an idea: if he ran with the best strategy, how soon would Orange catch up with him? Define that every second
Groundhog moves and then
Orange moves again. Groundhog can choose to stay put.
Groundhog would have solved that, of course, but he is running away now, so he give it to you, the smartest one.
输入描述:
The first line contains two integers
。
The next
lines,each line contains two integers
, indicating there is a corridor between the
dormitory and the
dormitory.
输出描述:
An integer, indicating the latest time for Orange to catch Groundhog.
备注:
.