Universal Cup Judging System

Universal Cup

时间限制: 2.0 s 内存限制: 1024 MB 总分: 100 可 Hack ✓
统计

มีจุด $N$ จุดบนเส้นจำนวน เริ่มต้นจุดที่ $i$ อยู่ที่พิกัด $A_i$

คุณสามารถดำเนินการต่อไปนี้กี่ครั้งก็ได้ ในลำดับใดก็ได้:

  • เลือกจุดสองจุดที่ต่างกัน $i$ และ $j$ แล้วสลับกัน
  • เลือกจุดสองจุดที่ต่างกัน $i$ และ $j$ แล้วสะท้อนจุด $i$ ข้ามจุด $j$ กล่าวอย่างเป็นทางการคือ กำหนดให้ $A_i := 2A_j - A_i$

เป็นไปได้หรือไม่ที่จะทำให้จุดที่ $i$ อยู่ที่ $B_i$ หลังจากการดำเนินการทั้งหมดสำหรับทุก $1 \le i \le N$?

ข้อมูลนำเข้า

ข้อมูลนำเข้าจะถูกกำหนดให้ในรูปแบบต่อไปนี้:

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.