NC222465. [USACOJan2020G]Springboards
描述
输入描述
The fist line contains two space-separated integers N and P.
The next P lines each contains four integers, x1, y1, x2, y2, where x1≤x2 and y1≤y2.
All springboard and target locations are distinct.
输出描述
Output a single integer, the minimum distance Bessie needs to walk to reach (N,N).
示例1
输入:
3 2 0 1 0 2 1 2 2 3
输出:
3
说明:
Bessie's best path is: