Grass Cutting
Time limit1sMemory limit512 MB
After each week every cell grows 1 cm, then cells in the chosen rows and columns are reset to 1 cm; report the final heights of the 10x10 grid.
- Level
Easy2 of 10
- Topics
- Simulation, Implementation, Array
- Solved
- No attempts yet
Problem
Mowing the lawn means dragging the machine out and walking back and forth across the yard until every blade of grass is cut. To spend less time on it, I now cut only part of the lawn each week.
The lawn is a grid of 100 sections. Each week I pick 3 rows and 3 columns, then cut the grass in every section that lies in one of them.
At the start every section is 1 cm high. Each week every section grows by 1 cm, and after that I cut the grass as described above. A section that is cut becomes 1 cm high.
You are given the rows and columns that were cut over the past few weeks. Report the height of every section immediately after the last cutting.
Input
The first line contains an integer (), the number of weeks this cutting method was used.
Each of the next lines describes one week and contains six integers. The first three are the rows picked that week, and the last three are the columns picked that week. Each of these numbers is between 1 and 10. The three rows are distinct, and the three columns are distinct.
Output
Print the grass heights immediately after the last cutting as a grid. The top row is row 1 and the bottom row is row 10. The left column is column 1 and the right column is column 10. Print the 10 values of each row on one line, separated by single spaces.