P2963 [USACO09NOV] Cow Rescue G

题目描述

Bessie is trapped in a triangular maze with N rows (1

输入格式

\* Line 1: Two space-separated integers: N and M \* Line 2: Two space-separated integers: Si and Sj \* Lines 3..M+2: Line i+2 contains two space-separated integers that are the triangle location of exit i: Ei and Ej

输出格式

\* Line 1: Two space-separated integers: OUTi and OUTj \* Line 2: A single integer: T