当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6281:Sorting

题目描述
Bobo has $n$ tuples $(a_1, b_1, c_1), (a_2, b_2, c_2), \dots, (a_n, b_n, c_n)$.
He would like to find the lexicographically smallest permutation $p_1, p_2, \dots, p_n$ of $1, 2, \dots, n$ such that for $i \in \{2, 3, \dots, n\}$ it holds that
$$\frac{a_{p_{i - 1}} + b_{p_{i - 1}}}{a_{p_{i - 1}} + b_{p_{i - 1}} + c_{p_{i - 1}}} \leq \frac{a_{p_i} + b_{p_i}}{a_{p_i} + b_{p_i} + c_{p_i}}.$$
输入解释
The input consists of several test cases and is terminated by end-of-file.

The first line of each test case contains an integer $n$.
The $i$-th of the following $n$ lines contains $3$ integers $a_i$, $b_i$ and $c_i$.
输出解释
For each test case, print $n$ integers $p_1, p_2, \dots, p_n$ seperated by spaces.
DO NOT print trailing spaces.

## Constraint

* $1 \leq n \leq 10^3$
* $1 \leq a_i, b_i, c_i \leq 2 \times 10^9$
* The sum of $n$ does not exceed $10^4$.
输入样例
2
1 1 1
1 1 2
2
1 1 2
1 1 1
3
1 3 1
2 2 1
3 1 1
输出样例
2 1
1 2
1 2 3
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6281

最后修改于 2020-10-25T23:29:56+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)