QOJ.ac

QOJ

Limite de temps : 2.0 s Limite de mémoire : 512 MB Points totaux : 100 Hackable ✓

#16797. 理想金字塔

Statistiques

每个法老都关心自己的遗产。在位的法老伊纳罗斯大帝(Inaros the Great)希望被世人永远铭记。他打算建造人类有史以来最大的金字塔。

当然,一座合格的金字塔底部应该有四个侧面,并朝向基本方位——金字塔的两侧应完全由南向北延伸,另外两侧应由东向西延伸。一座完美平衡的金字塔,其侧面的倾角应恰好为 $45^\circ$,不能多也不能少。为了简化建造,金字塔应具有整数高度和整数中心坐标。

施工现场有 $n$ 个方尖碑。第 $i$ 个方尖碑是一根坐标为 $(x_i, y_i)$、高度为 $h_i$ 的柱子。伊纳罗斯希望建造一座金字塔,使得每个现有的方尖碑都在金字塔内部。如果金字塔在方尖碑所在位置的高度大于或等于方尖碑的高度,则认为该方尖碑在金字塔内部。

由于法老希望在有生之年完成金字塔的建造,他希望找到能够容纳所有方尖碑的最小的可能金字塔。

输入格式

第一行包含一个整数 $n$ —— 方尖碑的数量($1 \le n \le 1000$)。

接下来的 $n$ 行,每行包含三个整数 $x_i, y_i, h_i$ —— 第 $i$ 个方尖碑的坐标及其高度($-10^8 \le x_i, y_i \le 10^8$;$1 \le h_i \le 10^8$)。

输出格式

输出三个整数 $x, y, h$ —— 最优金字塔的中心坐标 $(x, y)$ 及其高度。

样例

输入样例 1

1
0 0 5

输出样例 1

0 0 5

输入样例 2

2
3 3 3
6 6 2

输出样例 2

4 4 4

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.