QOJ.ac

QOJ

Límite de tiempo: 1.0 s Límite de memoria: 512 MB Puntuación total: 100 Hackeable ✓

#6812. 画一个三角形

Estadísticas

Little Desprado2 是 Springfield Flowers 幼儿园的一名学生。今天,他刚学会如何在网格坐标纸上画三角形。然而,他很快觉得这很无聊,于是他提出了一个更有趣的问题:

他在网格纸上画出了三角形的两个整点,并将其记为 $(x_1, y_1)$ 和 $(x_2, y_2)$。现在,他想知道:他应该在哪里画第三个点 $(x_3, y_3)$,才能使三角形的面积为正且最小?

显然,他太年轻且单纯,无法解决这个问题。你能告诉他答案吗?

请注意,你的答案坐标必须是整数,因为他是在网格纸上作图,且为了保持面积为正,三角形不能是退化三角形。

输入格式

第一行包含一个整数 $T$ ($1 \le T \le 50\,000$),表示 Little Desprado2 的询问次数。

对于每个测试用例,只有一行,包含四个整数 $x_1, y_1, x_2, y_2$ ($-10^9 \le x_1, y_1, x_2, y_2 \le 10^9$),用空格分隔,分别表示两个点 $(x_1, y_1)$ 和 $(x_2, y_2)$。

保证这两个点不重合。

输出格式

对于每个测试用例,输出两个整数 $x_3, y_3$ ($-10^{18} \le x_3, y_3 \le 10^{18}$),占一行,表示你的答案。

如果存在多个答案,你可以输出其中任意一个。保证在上述范围内存在解。

样例

样例输入 1

3
1 0 1 4
0 1 0 9
0 0 2 2

样例输出 1

2 0
1 1
-1 0

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.