• [I] iPhone Rune Master Puzzle

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • There's a game called Rune Master Puzzle in iPhone. It's a match puzzle game.
    You can swap adjacent Rune Stones in all 8 directions, that's legal. Otherwise, it's illegal.
    4 or more Rune Stones in a line(in all 8 directions) is called a Match. We don't consider about the Double and Triple.

    Your task is to tell me whether one swap is legal. If it's legal, you should tell me whether it's a Match.

  • 输入
  • This problem contains several cases.
    The first line is an integer T, indicates the number of cases.
    Then follow T cases.
    Each case has a matrix that 5 * 7. Including only 'Y' (Yellow), 'G' (Green), 'B' (Blue), 'R' (Red), 'P' (Purple).
    Then follows a single line formatted as '(x1, y1) (x2, y2)', indicates that the player wants to swap (x1, y1) with (x2, y2). (0 < x1, x2 < 5, 0 < y1, y2 < 7).
  • 输出
  • For each case, you should output the result.
    'Illegal', 'No Match' or 'Match'.
  • 样例输入
  • 1
    PPGYR
    PRPYG
    PGBPP
    BYBRB
    GBBBR
    GPGBP
    PBBBY
    (2, 5) (3, 5)
    
  • 样例输出
  • Match
    
  • 提示
  • 来源
  • XadillaX
  • 操作

显示春菜