当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3106:Flip and Turn

题目描述

Let us define a set of operations on a rectangular matrix of printable characters.

A matrix A with m rows (1-st index) and n columns (2-nd index) is given. The resulting matrix B is defined as follows.

  • Transposition by the main diagonal (operation identifier is ‘1’): Bj,i = Ai,j
  • Transposition by the second diagonal (‘2’): Bnj+1,mi+1 = Ai,j
  • Horizontal flip (‘H’): Bmi+1,j = Ai,j
  • Vertical flip (‘V’): Bi,nj+1 = Ai,j
  • Rotation by 90 (‘A’), 180 (‘B’), or 270 (‘C’) degrees clockwise; 90 degrees case: Bj,mi+1 = Ai,j
  • Rotation by 90 (‘X’), 180 (‘Y’), or 270 (‘Z’) degrees counterclockwise; 90 degrees case: Bnj+1,i = Ai,j

You are given a sequence of no more than 100 000 operations from the set. Apply the operations to the given matrix and output the resulting matrix.

输入解释

At the first line of the input file there are two integer numbers — m and n (0 < m, n ≤ 300). Then there are m lines with n printable characters per line (we define a printable character as a symbol with ASCII code from 33 to 126 inclusive). There will be no additional symbols at these lines.

The next line contains the sequence operations to be performed, specified by their one-character identifiers. The operations should be performed from left to right.

输出解释

Two integer numbers, the number of rows and columns in the output matrix. Then the output matrix must follow, in the same format as the input one.

输入样例
3 4
0000
a0b0
cdef
A1
输出样例
3 4
cdef
a0b0
0000

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3106

最后修改于 2020-10-29T06:52:52+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000 65536