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$.

האם ייתכן שהנקודה ה-$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.