提交链接:CF 689B
题面:
Recently, Mike was very busy with studying for exams and contests. Now he is going to chill a bit by doing some sight seeing in the city.
City consists of n intersections numbered from1 to n. Mike starts walking from his house located at the intersection number1 and goes along some sequence of intersections. Walking from intersection numberi to intersection j requires|i - j| units of energy. The total energy spent by Mike to visit a sequence of intersections p1 = 1, p2, ..., pk is equal to units of energy.
Of course, walking would be boring if there were no shortcuts. A shortcut is a special path that allows Mike walking from one intersection to another requiring only1 unit of energy. There are ex