22631_Divideetunita

2022-5-16 18:22| 发布者: Hocassian| 查看: 25| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506801048000-Problem List-采集的数据-后羿采集器.html

Pro.ID

22631

Title

Divide et unita

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22631

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 9000/3000 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    A polyomino is a two-dimensional figure formed from several squares with adjacent sides so that all the squares of polyomino can be visited by the rook moving each turn from one square belonging to the figure to its vertical or horizontal neighbour, also belonging to the figure.

    On an infinite squared paper sheet N2 squares are marked ( 2 <= N <= 5 ) that forms a polyomino P. You should write a program that divides this polyomino into two other polyominos, A and B, wherefrom using rotations and parallel translations (mirror reflection is not allowed), it is possible to assemble a square N*N. Only one of the possible solutions should be found.

    输入

    The input file will contain an image of a part of the sheet that contains the polyomino P, represented by the characters '.' (dot) denoting empty spaces and '*' (asterisk) denoting squares that belong to the figure (because it is impossible to put infinite squared sheet in a file, the input file describes only part of it; all the omitted squares are considered empty). There will be no other characters in the lines of the input file. The input file will not contain lines that are longer than 100 characters and there will be no more than 100 lines. There will be always at least one solution for the given input file.

    输出

    Description

    A polyomino is a two-dimensional figure formed from several squares with adjacent sides so that all the squares of polyomino can be visited by the rook moving each turn from one square belonging to the figure to its vertical or horizontal neighbour, also belonging to the figure.

    On an infinite squared paper sheet N2 squares are marked ( 2 <= N <= 5 ) that forms a polyomino P. You should write a program that divides this polyomino into two other polyominos, A and B, wherefrom using rotations and parallel translations (mirror reflection is not allowed), it is possible to assemble a square N*N. Only one of the possible solutions should be found.

    Input
    The input file will contain an image of a part of the sheet that contains the polyomino P, represented by the characters '.' (dot) denoting empty spaces and '*' (asterisk) denoting squares that belong to the figure (because it is impossible to put infinite squared sheet in a file, the input file describes only part of it; all the omitted squares are considered empty). There will be no other characters in the lines of the input file. The input file will not contain lines that are longer than 100 characters and there will be no more than 100 lines. There will be always at least one solution for the given input file.
    Output
    Echo the image of the given part of sheet with polyomino into the output file replacing each asterisk with characters 'A' or 'B' in accordance with which of polyominos (parts), A or B, this square belongs to. The output file should contain the same lines with the same order except for the above described changes.
    Sample Input
    ..
    ......
    ....*.
    ..*.*
    ..***
    ..****
    ..*..*
    ..****
    .......
    Sample Output
    ..
    ......
    ....B.
    ..B.B
    ..BBB
    ..AABA
    ..A..A
    ..AAAA
    .......
    Hint
    Special Judge
    Source

    样例输入

    ..
    ......
    ....*.
    ..*.*
    ..***
    ..****
    ..*..*
    ..****
    .......

    样例输出

    ..
    ......
    ....B.
    ..B.B
    ..BBB
    ..AABA
    ..A..A
    ..AAAA
    .......

    提示

    Special Judge


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部