|Online MIPT programming contest||РУССКИЙ|
Time limit = 5Frame 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.
5 6 2 3 4
21 May 2003
© acm.mipt DevGroup
The page was generated in 220ms