22740_UnchangedPicture

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

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

Pro.ID

22740

Title

Unchanged Picture

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 10000/10000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Steganography is a special way to protect messages — instead of encryption, the message is somehow hidden. Historically, it was quite a popular technique, but nowadays it is superseded by ciphers, especially those based on keys. However, sometimes it may still be in use. One of the digital steganographic techniques is to hide small pieces of information into a digital image. The image modification is so small that it cannot be spotted by a human eye, but the information (such as a text message) is there and readable by computers. Your task is to compare two images and find such (possibly small) differences.

    In this problem, we will focus on vector pictures. Your program is given two pictures and it should decide whether they contain the same image. Geometrically speaking, decide whether the two picture are similar, that means whether they can be transformed into each other using translation, rotation, and uniform scaling (but not mirroring). An example of two similar pictures follows.

    输入

    The input file consists of several test cases, each of them containing two vector pictures. Each picture is described by a sequence of instructions for a plotter device, one instruction per row. Every instruction begins with an uppercase letter followed by one space character and two integer coordinates separated by another space. The letter is either "L" (draw a line) or "M" (move without drawing). The coordinates specify the place to which the line is to be drawn or the current position moved. Coordinates are always given relatively to the end position of the previous instruction. The first instruction is relative to some (unspecified) starting point.

    The last instruction of each picture is followed by a row containing the letter "E" (end) and an empty line. The last test case will be followed by a row containing the letter "Q" (quit).

    The number of instructions for any picture is between 0 and 1000, inclusive. No instruction has both coordinates equal to zero. The absolute value of all (relative) coordinates is at most 1000.

    输出

    Description

    Steganography is a special way to protect messages — instead of encryption, the message is somehow hidden. Historically, it was quite a popular technique, but nowadays it is superseded by ciphers, especially those based on keys. However, sometimes it may still be in use. One of the digital steganographic techniques is to hide small pieces of information into a digital image. The image modification is so small that it cannot be spotted by a human eye, but the information (such as a text message) is there and readable by computers. Your task is to compare two images and find such (possibly small) differences.

    In this problem, we will focus on vector pictures. Your program is given two pictures and it should decide whether they contain the same image. Geometrically speaking, decide whether the two picture are similar, that means whether they can be transformed into each other using translation, rotation, and uniform scaling (but not mirroring). An example of two similar pictures follows.

    Input

    The input file consists of several test cases, each of them containing two vector pictures. Each picture is described by a sequence of instructions for a plotter device, one instruction per row. Every instruction begins with an uppercase letter followed by one space character and two integer coordinates separated by another space. The letter is either "L" (draw a line) or "M" (move without drawing). The coordinates specify the place to which the line is to be drawn or the current position moved. Coordinates are always given relatively to the end position of the previous instruction. The first instruction is relative to some (unspecified) starting point.

    The last instruction of each picture is followed by a row containing the letter "E" (end) and an empty line. The last test case will be followed by a row containing the letter "Q" (quit).

    The number of instructions for any picture is between 0 and 1000, inclusive. No instruction has both coordinates equal to zero. The absolute value of all (relative) coordinates is at most 1000.

    Output

    For each test case, print one line containing either the word "YES" (two pictures are similar) or "NO" (pictures are not similar).

    Sample Input

    L 3 1
    L 3 1
    M 3 0
    M 0 1
    L -3 -1
    E

    L 1 0
    L -1 0
    E

    L 1 0
    L 0 1
    E

    L 1 0
    L -1 -1
    E

    L 2 0
    L 1 1
    L 0 1
    L 2 3
    L 0 1
    L -1 1
    L -2 0
    L -1 -1
    L 0 -1
    L 2 -3
    M 1 0
    L -2 0
    M 2 0
    L 0 -1
    L -1 1
    L -1 -1
    L 0 1
    E

    L 2 -4
    L 3 -1
    L 2 1
    L 1 -2
    L -2 -1
    L 1 3
    L -3 1
    L 2 1
    L 1 -2
    L 8 -1
    L 2 1
    L 1 3
    L -2 4
    L -3 1
    L -2 -1
    L -4 -7
    E

    Q

    Sample Output

    YES
    NO
    YES

    Source

    样例输入

    L 3 1
    L 3 1
    M 3 0
    M 0 1
    L -3 -1
    E

    L 1 0
    L -1 0
    E

    L 1 0
    L 0 1
    E

    L 1 0
    L -1 -1
    E

    L 2 0
    L 1 1
    L 0 1
    L 2 3
    L 0 1
    L -1 1
    L -2 0
    L -1 -1
    L 0 -1
    L 2 -3
    M 1 0
    L -2 0
    M 2 0
    L 0 -1
    L -1 1
    L -1 -1
    L 0 1
    E

    L 2 -4
    L 3 -1
    L 2 1
    L 1 -2
    L -2 -1
    L 1 3
    L -3 1
    L 2 1
    L 1 -2
    L 8 -1
    L 2 1
    L 1 3
    L -2 4
    L -3 1
    L -2 -1
    L -4 -7
    E

    Q

    样例输出

    YES
    NO
    YES

    提示

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部