Frame
InterviewTime limit5sMemory limit256 MB
You must answer YES or NO for each of N bar lengths based on whether bars of that length tile the one-cell-thick X by Y frame.
- Level
Medium5 of 10
- Topics
- Math, Brute force
- Solved
- No attempts yet
Problem
Take an rectangle of unit cells and cut out the middle rectangle. The figure that remains is a frame of size . A frame is a border one cell thick, so it has cells.
You have an unlimited supply of tiles. A tile can be rotated by 90 degrees. Tiles must stay inside the frame and must not overlap. Decide whether the frame can be paved completely with these tiles. For example, a frame of size can be paved with tiles, but it cannot be paved with tiles.
Input
The first line contains two integers and (, ).
The second line contains an integer , the number of tile types to analyze ().
Each of the next lines contains one integer. The integer on the -th of those lines is ().
Output
Print lines. The -th line contains YES if a frame of size can be paved with tiles, and NO if it cannot.