topcoder; solve "NarrowPassage2Easy" from SRM #638 (Div. 2)