|
||||
FrameLet's consider a rectangle of size X × Y with the middle rectangle of size (X – 2) × (Y – 2) cut out. We will call this figure a frame of size X × Y. Figure 1 shows the frame of size 5 × 6.
Let's assume that we have unlimited number of tiles of size A × 1. Consider the following problem: is it possible to completely pave a frame of size X × Y using these tiles (tiles can be rotated by 90 degrees)? For example, a frame of size 5 × 6 in Figure 1 can be paved completely with tiles of size 3 × 1 (one way to do so is shown in Figure 2), but can't be paved with tiles of size 4 × 1. Input SpecificationThe first input line contains two integers X and Y (3 ≤ X ≤ 106, 3 ≤ Y ≤ 106). The second line contains an integer N, the number of tile types to be analyzed (1 ≤ N ≤ 1000). Each of the following N lines contains one integer, not exceeding 106. Let's denote the integer on the (K + 2)-th line of the input with AK. Output Specification
Output N lines, where the Kth line should contain the word
“ Sample Input
Output for Sample Input
Original Problem |
||||
University of Debrecen; Faculty of Informatics; v. 03/01/2019 |