<PREV Problem:
NEXT>
Solved by 734 users: ...
UserDateAttemptTimeCMSC
Nakilon12 jan 2010Ruby100.0342 
abortmozga.ru03 jun 2009C++1700.0161 
sb3ar23 dec 2007Ruby600.0262 
Vladislav_Simonenko20 mar 2006FPC300.0263 
PetrovSergey06 jan 2005FPC2?.??70 
kornakovBSU21 dec 2010C++700.0171 
sb3ar28 apr 2007Ruby300.0272 
Senya16 nov 2009C++200.0273 
abortmozga.ru03 jun 2009C++1500.0174 
abortmozga.ru03 jun 2009C++1400.0175 
QWE05 nov 2007Kylix400.0278 
DAV03 jun 2009C++400.0278 
david_it2116 apr 2008Ruby100.0378 
DAV03 jun 2009C++500.0279 
kornakovBSU26 jul 2009C++200.0181 
Languages
C++
344
FPC
205
C
108
Kylix
37
Java
30
Ruby
8
Python
4
Haskell
1
Perl
1
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

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 200ms

SW soft NIX
ID = 18.207.130.162