Universal Cup Judging System

Universal Cup

Limite de temps : 1.0 s Limite de mémoire : 1024 MB Points totaux : 100 Difficulté: [afficher] Hackable ✓
Statistiques

中國象棋係一項老少咸宜嘅熱門遊戲。呢一點甚至喺第 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.