P27074 [AtCoder] Best Strategy
普及+
题目描述

Problem Description

There is a quiz game with $N$ questions numbered from $1$ to $N$, and you are participating in this game.

In this game, you answer the questions one by one. You can freely choose the order in which you answer the questions. When you answer question $i$, you have a $P_i$% chance of getting it correct. If you get it correct, you earn $S_i$ points and move on to the next question (if there are any unanswered questions left). If you get it wrong, the game ends immediately, and you can no longer answer the remaining questions.

You want to maximize the expected total score you can earn. Determine the strategy (i.e., the order in which you answer the questions) to achieve this goal. Note that the probability of getting each question right or wrong is independent of each other.

Input Format

The input is given from the standard input in the following format:

$ N $ $ S_1 $ $ P_1 $ $ S_2 $ $ P_2 $ $\vdots$ $ S_N $ $ P_N $

Output Format

Output the answer in the following format:

$ x_1 $ $ x_2 $ $\cdots$ $ x_N $

Here, $ x_i $ represents the number of the question you will answer next if you have correctly answered the first ($ i-1 $) questions. If there are multiple solutions, any one of them will be considered correct.

Sample Input and Output

Sample Input #1

2
1000 10
300 50

Sample Output #1

2 1

Sample Input #2

6
1 0
1 20
1 40
1 60
1 80
1 100

Sample Output #2

6 5 4 3 2 1

Sample Input #3

9
88994950 78
405248480 35
561113280 28
22802150 2
946582650 25
201425280 52
669650 41
128877450 71
1396050 25

Sample Output #3

1 5 8 2 3 6 4 7 9

Notes/Hints

Constraints

  • $1\ \leq\ N\ \leq\ 2\ \times\ 10^5$
  • $1\ \leq\ S_i\ \leq\ 10^9$
  • $0\ \leq\ P_i\ \leq\ 100$
  • All input values are integers.

Sample Explanation 1

If you answer questions $1,2$ in that order, the expected total score is $115$. If you answer questions $2,1$ in that order, the expected total score is $200$. Therefore, the optimal strategy is to answer questions $2,1$ in that order.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 1000 10 300 50
样例输出
2 1