Universal Cup Judging System

Universal Cup

Time Limit: 1.0 s Memory Limit: 1024 MB Total points: 100 Difficulty: [show] Hackable ✓
Statistics

中國象棋是一項深受各年齡層喜愛的大眾遊戲。這一點甚至在第 49 屆 ICPC 全球總決賽上也受到了關注。

problem_14811_8c39be3c1b549f2bbeb7c157ddfc4f49.png

攝於第 49 屆 ICPC 全球總決賽

今天,剛學會象棋規則的你向特級大師 Nanani 發起挑戰。特級大師不想讓你壓力太大,因此你們將進行簡化版的遊戲,規則如下:

  • 棋盤有 $9$ 行(直行)與 $10$ 列(橫列)。棋盤上僅放置兩枚棋子:一隻馬與一隻車。若一枚棋子位於第 $x$ 行、第 $y$ 列,我們將其位置記為 $(x, y)$。車與馬都必須留在棋盤內,不得移出棋盤外。
  • 兩位玩家輪流移動自己的棋子。若在某位玩家移動後,其棋子移動到對手棋子所在的確切位置,則稱該玩家「吃掉」了對手的棋子,且遊戲結束。
  • 馬的移動規則如下:
    • 若 $(x_N + 1, y_N)$ 為空,它可以從 $(x_N, y_N)$ 移動到 $(x_N + 2, y_N \pm 1)$。
    • 若 $(x_N - 1, y_N)$ 為空,它可以從 $(x_N, y_N)$ 移動到 $(x_N - 2, y_N \pm 1)$。
    • 若 $(x_N, y_N + 1)$ 為空,它可以從 $(x_N, y_N)$ 移動到 $(x_N \pm 1, y_N + 2)$。
    • 若 $(x_N, y_N - 1)$ 為空,它可以從 $(x_N, y_N)$ 移動到 $(x_N \pm 1, y_N - 2)$。
  • 車可以移動到同一列或同一行上的任何其他位置,但不能跳過另一枚棋子。
  • 每位玩家在自己的回合都必須移動自己的棋子。可以證明,在任何情況下當前玩家總有辦法移動自己的棋子。

特級大師控制馬,而你控制車,由特級大師先手。車是否存在一種策略,使得無論馬如何應對,車都能在有限步內吃掉馬,且不會被馬吃掉?

輸入格式

有多組測試資料。輸入的第一行包含一個整數 $T$($1 \le T \le 8010$),代表測試資料的組數。對於每組測試資料:

第一行也是唯一的一行包含四個整數 $x_N$、$y_N$、$x_R$ 與 $y_R$($1 \le x_N, x_R \le 9$,$1 \le y_N, y_R \le 10$),其中 $(x_N, y_N)$ 為馬的初始位置,$(x_R, y_R)$ 為車的初始位置。保證兩枚棋子的初始位置不同。

輸出格式

對於每組測試資料輸出一行。若車存在這樣的策略,請輸出 YES,否則輸出 NO。

範例

2
1 5 2 5
1 1 2 3
YES
NO

說明

範例測試資料如下圖所示。紅色棋子代表馬,黑色棋子代表車。

problem_14811_663ee8790906d5e8365bd46375c0154f.png

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.