“Paper cutting is the art of cutting paper designs. ”
“Chinese Paper Cutting or Jianzhi is the first type of papercutting design, since paper was
invented by Cai Lun in the Eastern Han Dynasty in China. The art form later spread to other
parts of the world with different regions adopting their own cultural styles. Because the cut
outs are also used to decorate doors and windows, they are sometimes referred to "chuāng
huā", meaning Window Flower.”
--WikiPedia
Alice is a fan of interesting Chinese paper cutting (ICPC). When she first saw it in her
grandmother’s house, she immediately fell in love with this art. And from then on, she began
to collect various paper cutting designs and tried to create her own works as well. At first, she
couldn’t manipulate her scissors and often cut inappropriate parts. Sometimes, she even hurt
herself. She had many beautiful designs in her mind, but she was unable to realize them. She
was so disappointed for that. However, she didn’t give up. She persisted in practicing,
learning from books and experts. At last, she found a key feature of paper cutting. That is
symmetry.
Symmetry is very important for paper cutting. It not only beautifies the whole work but also
makes the cutting process easy. Therefore, cutting each part of a work independently is not a
good choice. Instead, it will be better to fold and cut alternately.
Now Alice is experienced and works out a paper cutting process which is safe and easy. So
she invents a machine that can perform paper cutting following her instructions.
This machine has a wide foldable board and a coordinate system on the board. Before the
machine runs, she puts a piece of rectangular paper on the board. Two edges of the paper
accord with X-axis and y-axis respectively. X-axis is from left to right and y-axis is from top
down.
Then she starts up the machine and performs a paper cutting process by repeating two types
of instructions:
The first number indicates the number of test cases. It will not exceed 50.
For each test case, the first line contains two integers L, W (0<L, W<=100) indicating the
length and width of the paper. The top left corner of the paper is at (0, 0).
The second line is a single number T indicating how many instructions she will execute. (0<=
T <= 100)
The following T lines each are an instruction:
Or
Here are the two points which should be in the same place after folding.
You can assume that they are distinct and locate in the same vertical or horizontal line.
) indicates the knife’s path. All the segments are veridical or
horizontal.
The output of each case should consist of W rows. Each row includes L characters. If
the area of [j-1,j]*[i-1,i] remains in the final design, you should print a ‘@’ for the j-th
character of the i-th row; Otherwise, print a ‘.’
Output an empty line at the end for each test case.
3 3 3 3 fold 0 3 0 0 fold 3 0 0 0 cut 3 0 1 1 1 1 0 4 3 3 fold 4 0 0 0 cut 2 2 0 2 3 cut 4 2 1 1 1 1 2 2 2 12 14 8 fold 12 0 0 0 fold 0 14 0 5 fold 0 9 0 4 fold 0 0 0 5 fold 0 3 0 4 fold 0 0 5 0 cut 3 0 6 4 6 4 10 cut 5 6 4 3 4 3 5 5 5 5 10
.@. @@@ .@. @@.. @... @@.. ..@......@.. @@@@@@@@@@@@ ..@......@.. @@@@@@@@@@@@ ..@......@.. @@@@@..@@@@@ @...@..@...@ @@@@@..@@@@@ ..@......@.. @@@@@@@@@@@@ ..@......@.. @@@@@..@@@@@ @...@..@...@ @@@@@..@@@@@
Migrated from old NTUJ.
2009Hefei
No. | Testdata Range | Score |
---|