#1104. Chocolate
Chocolate
No testdata at current.
No submission language available for this problem.
Background
Special for beginners, ^_^
Description
Ms. AtCoder has decided to distribute chocolates to N friends on Valentine's Day. For the i-th friend (1≤i≤N), she wants to give a square chocolate bar of size ×.
She has procured a rectangular chocolate bar of size H×W. It is partitioned by lines into a grid of H rows and W columns, each cell being a 1×1 square.
Determine whether it is possible to divide the chocolate bar along the lines into several pieces to obtain all the chocolate bars for her friends. It is fine to have leftover pieces.
Format
Input
The input is given from Standard Input in the following format:
H W N
A1 A2 A3 ... AN
Output
If the objective is achievable, print Yes; otherwise, print No.
Samples
4 4 4
1 0 0 1
Yes
5 7 6
0 1 0 2 0 1
Yes
3 2 7
0 0 0 0 0 0 0
No
11 11 2
2 3
No
777 777 6
8 6 9 1 2 0
Yes
样例1

Limitation
- 1≤W≤109
- 1≤N≤1000
- 0≤Ai≤25 (1≤i≤N)
- All input values are integers.
1s, 1024KiB for each test case.