Formatting Software Problem Description Vivek is developing software that takes a set of…
- User
Formatting Software Problem Description Vivek is developing software that takes a set of numerical instructions, processes them, and formats them as required. Vivek is working on a big project, and he asked you to implement a software that takes a set of numerical information in the form of r x c matrices, processes them, and formats them according to the given instructions. The instructions consist of multiple lines, with each line containing one or more integer values. Each integer specifies which matrix should be printed.
For example, if the instructions are like below:
Copy code 4
1 2 3
This says that you should first print matrix number 4 from the information provided. Then, on the subsequent lines, you need to print matrices 1, 2, and 3 sequentially.Given N, representing the number of matrices, and two additional integers r and c representing the number of rows and columns in each matrix, along with the N matrices provided contiguously over r lines in the described format, print the formatted information.
(Refer to the Examples section for better understanding of the input.)
Constraints
1 ≤ 𝑁 ≤ 10 1≤N≤10 1 ≤ 𝑟 , 𝑐 ≤ 10 1≤r,c≤10 1 ≤ numbers in the matrix ≤ 100 1≤numbers in the matrix≤100 1 ≤ number of matrices in the instructions ≤ 20 1≤number of matrices in the instructions≤20 Input
The first line consists of an integer 𝑁 N, denoting the number of matrices. The second line consists of two space-separated integers denoting the number of rows 𝑟 r and columns 𝑐 c in each matrix. The next 𝑟 r lines contain the 𝑁 N matrices, each of size 𝑟 × 𝑐 r×c, listed sequentially. Each matrix will have integers separated by spaces, and consecutive matrices will be separated by a space as well. The remaining lines represent the instructions for how the information should be formatted. Output Print the formatted information following the given instructions.
Time Limit 1 second
Examples Example 1 Input
Copy code 7
1 35 4 12 11 19 3 0 15 7 1 2 3 4 5 6 10 9 8 3 6 7
5
7 1 3
2 4 6
3 6
OutputCopy code 4 5 6
3 6 7
0 15 7
1 2 3
11 19 3
60 71 5
4 12 0
15 7
Example 2 InputCopy code 4
2 31 2 3 4 5 6 7 8 9 10 11 12
12 11 10 9 8 7 6 5 4 3 2 1
1 2 3
4 1
2 33
1 4
OutputCopy code 1 2 3
4 5 6
7 8 9
10 11 12
12 11 10
9 8 7
6 5 4
3 2 1
10 11 12
1 2 3
12 11 10
3 2 1 give c++ most optimium code - Assistant