<PREV Problem:
NEXT>
Solved by 731 users: ...
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 

Frame paving

Time limit = 5

Frame X x Y is rectangle X x Y with center rectangle (X — 2) x (Y — 2) dropped out. We have many tiles A x 1.

Is it possible to cave frame X x Y with tiles A x 1?

For example, frame 5 x 6 can be tiled with tiles 3 x 1, but not with tiles 4 x 1.

Input The first line contains two positive integers X and Y (3 ≤ X, Y ≤ 106). The second line containe one positive integer N — number of tile types, (1 ≤ N ≤ 1000). The third line contains N positive integers less than 106 — lengths of tiles.

Output N lines with YES or NO. i-th line contains YES if it is possible to tile the frame with tiles of i-th type. Output NO otherwise.

Input#1
5 6
2
3 4
Output#1
YES
NO

Author:
Kvasov Igor
21 May 2003

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 190ms

SW soft NIX
ID = 54.81.197.127