#C5926. Forest State Query
Forest State Query
Forest State Query
You are given a record of forest configurations over several days. The forest is represented as an n × n grid. You are also given k past forest states and q queries. Each query is an integer \(d\) (1-indexed) representing the day in the past, and you need to output the corresponding forest configuration.
Input Format:
- The first line contains three integers \(n\), \(k\), and \(q\), where \(n\) denotes the side length of the forest, \(k\) is the number of recorded states, and \(q\) is the number of queries.
- The next \(k \times n\) lines describe the forest states. Each state consists of \(n\) lines, each containing a string of length \(n\) which represents a row in the forest.
- The last line contains \(q\) integers representing the queries. Each integer \(d\) satisfies \(1 \leq d \leq k\) and indicates that you should output the forest state from the \(d\)th recorded state.
Output Format:
For each query, print the corresponding forest state. Each state should be printed as \(n\) lines, and consecutive states should be separated by an empty line.
Example:
Input: 3 2 2 ### #.# ### .## ### ### 1 2Output:
#.#
.##
inputFormat
The first line contains three space-separated integers \(n\), \(k\), and \(q\). \(n\) is the size of the forest grid, \(k\) is the number of recorded states, and \(q\) is the number of queries.
This is followed by \(k \times n\) lines, where each block of \(n\) lines represents one forest state.
The final line consists of \(q\) space-separated integers. Each integer denotes the day (1-indexed) whose forest configuration is to be output.
outputFormat
For each query, output the corresponding forest configuration as \(n\) lines. If there are multiple queries, separate the output for consecutive queries with an empty line.
## sample3 2 2
###
#.#
###
.##
###
###
1 2
###
#.#
.##
###
</p>