Universal Cup Judging System

Universal Cup

시간 제한: 2.0 s 메모리 제한: 1024 MB 총점: 100 해킹 가능 ✓
통계

數軸上有 $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.