5159: Pie or die

内存限制:256 MB 时间限制:2 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:3 通过:3

题目描述



C. Pie or die
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input


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 players follow the optimal strategy.
Input
First line contains 3 integers, separated by space: 1≤n,m≤100 − dimensions of the board and 0≤k≤100 − the number of pies. Each of the next k lines contains 2 integers, separated by space: 1≤xn, 1≤ym − coordinates of the corresponding pie. There could be more than one pie at a cell.
Output
Output only one word: "YES" − if Volodya wins, "NO" − otherwise.
Examples
Input
2 2 1
1 2
Output
YES
Input
3 4 0
Output
NO
Input
100 50 2
50 25
50 25
Output
NO

输入格式

输出格式

输入样例 复制


输出样例 复制


数据范围与提示