No.759 悪くない忘年会にしような!
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
Problem Statement
You are looking for a restaurant for a year-end party, but there are many restaurants in the world, and you do not have enough time to look at all of them.
For each restaurant $i (1 \le i \le N)$, you have data on three axes: the price rating $P_i$, the allowed length of stay rating $T_i$, and the review rating $R_i$. You decided to use this data to reduce the number of restaurants you need to check.
Restaurant $j$ is said to be inferior to restaurant $i$ when at least one of 1, 2, 3 holds.
1. $ P_j \lt P_i$ and $T_j \le T_i$ and $R_j \le R_i$
2. $ P_j \le P_i$ and $T_j \lt T_i$ and $R_j \le R_i$
3. $ P_j \le P_i$ and $T_j \le T_i$ and $R_j \lt R_i$
List the restaurants that are not inferior to any restaurant, in ascending order.
* It has been confirmed that AC is achievable in C++ and Rust. The writer has not achieved AC in PyPy.
Input
$N$ $P_1\ T_1\ R_1$ $P_i\ T_i\ R_i$ $P_N\ T_N\ R_N$
The first line contains the number of restaurants $N$.
Line $i+1$ contains the price rating $P_i$, the allowed length of stay rating $T_i$, and the review rating $R_i$ of restaurant $i (1 \le i \le N)$, separated by single-byte spaces.
$ 1 \le N \le 10^5$
$ 0 \le P_i,T_i, R_i \le 10^4$
$ i \ne j \Leftrightarrow (P_i, T_i, R_i) \ne (P_j, T_j, R_j)$
Output
Print a newline at the end.
Sample
Sample 1
Input
5 5 2 1 4 4 4 3 3 1 0 0 1 5 8 0
Output
1 2 5
Restaurant 3 is excluded because it is inferior to restaurant 2, and restaurant 4 is excluded because it is inferior to restaurants 1, 2, 3.
Sample 2
Input
3 1 0 0 0 1 0 0 0 1
Output
1 2 3
Sample 3
Input
3 1 1 1 2 3 4 5 5 5
Output
3
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
matsu7874
はむこ