import sys
n = int(input())
a, b = map(int, input().strip().split())
c, d = map(int, input().strip().split())
yes = 'YES'
no = 'NO'
# 前两种情况
if a + b == c + d:
print(yes)
# 第三种情况
elif a - b == c - d and max(b, d) < n - 1:
print(yes)
else:
print(no)
只有三种情况可行:重合,↗️ 排列,↖️ 排列。
前两种不用添加障碍,第三种需在右下角添加一个障碍,但是这个障碍不能出界也不能堵住终点。

京公网安备 11010502036488号