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.