C. Pie or die
time limit per test
2 seconds
memory limit per test
256 megabytes
output
standard output
沃洛迪亚和弗拉德玩以下游戏。在n×m板的单元处有k个馅饼。每转一圈Volodya都会将一个饼移动到相邻的(旁边)单元格。如果馅饼位于棋盘的边缘,那么沃洛迪亚可以将其移出棋盘,拿到馅饼并获胜。沃洛季亚移动后,弗拉德在长度为1的木板边缘(木板的两个结之间)禁止了一些边缘,这样沃洛季娅就不能再通过这个边缘将馅饼移出木板。问题是:沃洛迪亚会赢得这场比赛吗?我们假设双方都遵循最佳策略。
输入
第一行包含3个整数,用空格分隔:1≤n,m≤100−板的尺寸,0≤k≤100−馅饼的数量。接下来的k行中的每一行包含2个整数,用空格分隔:1≤x≤n,1≤y≤m−相应饼图的坐标。一个牢房里可能有不止一个馅饼。
输出
只输出一个单词:“是”−如果沃洛迪亚获胜,“否”−否则。
Volodya and Vlad play the following game. There are
k pies at the cells of
n×m 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 pla
yers follow the optimal strategy.
Output
Output only one word: "
YES" − if Volodya wins, "
NO" − otherwise.