Universal Cup Judging System

Universal Cup

Limite de temps : 2.0 s Limite de mémoire : 1024 MB Points totaux : 100 Hackable ✓
Statistiques

數軸上面有 $N$ 個點。最初,第 $i$ 個點位於座標 $A_i$ 處。

你可以按任意順序執行以下操作任意次數:

  • 揀兩個唔同嘅點 $i$ 同 $j$,並交換佢哋。
  • 揀兩個唔同嘅點 $i$ 同 $j$,並將點 $i$ 關於點 $j$ 作對稱反射。形式化嚟講,令 $A_i := 2A_j - A_i$。

有冇可能喺完成所有操作之後,對於所有 $1 \le i \le N$,第 $i$ 個點都位於 $B_i$ 處?

輸入格式

輸入按以下格式俾出:

T
N
A_1 B_1
A_2 B_2
:
A_N B_N
:
  • 所有輸入值都係整數。
  • $1 \le T \le 10^4$
  • $1 \le N \le 2 \times 10^5$
  • $-10^9 \le A_i, B_i \le 10^9$
  • 保證所有測試用例入面 $N$ 嘅總和唔超過 $2 \times 10^5$。

輸出格式

對於每個測試用例,如果可以達到目標最終狀態,就輸出 YES,否則輸出 NO。

你可以用任意大細階輸出答案。例如,字串 YES、yes 同 yEs 都會被視為肯定嘅回答。

範例

範例輸入 1

6
1
1 1
1
0 2
2
0 3
1 2
2
1 5
2 7
3
-3 5
9 13
7 5
3
-3 11
9 25
7 9

範例輸出 1

YES
NO
YES
NO
NO
YES

說明

測試用例 3:一種有效嘅操作序列為:

  1. 由座標 $[0, 1]$ 開始。
  2. 將點 $1$ 關於點 $2$ 作對稱反射。座標變為 $[2, 1]$。
  3. 交換點 $1$ 同點 $2$。座標變為 $[1, 2]$。
  4. 將點 $1$ 關於點 $2$ 作對稱反射。座標變為 $[3, 2]$。

測試用例 2、4 同 5:可以證明冇辦法令啲點去到目標座標。

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.