#P4651. Pie or die
Pie or die
Pie or die
题面翻译
Volodya 和 Vlad 在下一盘棋,在棋盘的 () 格中有 () 个棋子。
每轮 Volodya 将一个棋子移动到相邻的单元格中。如果棋子位于棋盘边界,Volodya 可以将其移出棋盘并获胜。在Volodya 移动之后,Vlad 会在棋盘边界上放上长度为 1 的挡板(图中黑线),这样下一轮中 Volodya 就不能再通过这条边线将棋子移到棋盘外了。
问:Volodya 会赢得这盘棋吗?我们假设两位棋手都采用了最优策略。
翻译来自 jianhe。
题目描述
Volodya and Vlad play the following game. There are pies at the cells of board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move it outside the board, get the pie and win. After Volodya's move, Vlad bans some edge at the border of the board of length 1 (between two knots of the board) so that Volodya is not able to move the pie outside the board through this edge anymore. The question is: will Volodya win this game? We suppose both players follow the optimal strategy.
输入格式
First line contains 3 integers, separated by space: — dimensions of the board and — the number of pies. Each of the next lines contains 2 integers, separated by space: , — coordinates of the corresponding pie. There could be more than one pie at a cell.
输出格式
Output only one word: "YES" — if Volodya wins, "NO" — otherwise.
样例 #1
样例输入 #1
2 2 1
1 2
样例输出 #1
YES
样例 #2
样例输入 #2
3 4 0
样例输出 #2
NO
样例 #3
样例输入 #3
100 50 2
50 25
50 25
样例输出 #3
NO