UNDERSEA HYDROCARBONS
In extensive areas of the Greek seas (marine areas), it is estimated that there are enormous quantities of hydrocarbons. The extraction of hydrocarbons from great depths (up to 3000m below the sea surface and up to 6000m within the seabed) can only be carried out by a few very large multinational companies. The extraction is feasible based on a large number of parameters: the recoverable quantity (which is a function of many parameters), the depth of extraction, the number of required wells, and the assessment of stability. These are some of the key parameters that need to be estimated.
If the recoverable quantity is a, the depth is b, and the number of wells is c, a computational efficiency relationship for the investment could be defined, assuming a constant value of hydrocarbons:
It is evident that extraction can only be attempted if the calculated efficiency value is positive. For obvious reasons, among multiple "marine areas," extraction begins from the one with the highest efficiency value.
Problem
Develop a program in one of the IOI languages (PASCAL, C, C++, Java) that, after reading the number of plots and the triplet of integer values a, b, c for each of them, returns in descending order of efficiency the numbers of the plots where drilling is feasible.
Input Files:
The input files with the name hydrocarbons.in are text files with the following structure: The first line contains an integer N , the number of maritime plots. We consider that the plots are numbered from to in the order they appear in the input. In each of the next lines, there is a triplet of integers a_i, b_i, c_i, separated by a single space. These numbers represent the efficiency parameters of the i-th plot, as described above. Assume 1 ≤ a_i ≤ 1,000,000,000, 1 ≤ b_i ≤ 3,000, and 1 ≤ c_i ≤ 40.
Output Files:
The output files with the name hydrocarbons.out are text files with the following structure.The first line contains an integer M: the number of plots where drilling is efficient. The next line contains exactly M space separated numbers between 1 and N: the increasing numbers of the plots where drilling is efficient. The plots should be given in descending order of their efficiency (i.e., the value calculated by the formula provided earlier). If two plots have the same efficiency value, the one with the smaller increasing number should come first.
Examples of Input - Output Files:
1o
STDIN (hydrocarbons.in)
4
45000000 2000 10
150000000 2000 10
45000000 2500 20
90000000 2500 5
STDOUT (hydrocarbons.out)
3
2 1 4
The plots in order have efficiencies of approximately , , , and .
2o
STDIN (hydrocarbons.in)
2
40000000 2700 30
30000000 2800 18
STDOUT (hydrocarbons.out)
0
Notes:
Formatting: In both the input and the output, each line terminates with a newline
character.
Maximum execution time: 1sec.
Maximum available memory: 64MB.
Headers in the source code: At the beginning of your source code, you should use the following headers.
(* USER: username
LANG: PASCAL
TASK: hydrocarbons *)
for PASCAL coders
/* USER: username
LANG: C
TASK: hydrocarbons */
for C coders
/* USER: username
LANG: C++
TASK: hydrocarbons */
for C++ coders
/* USER: username
LANG: Java
TASK: hydrocarbons */
for Java coders
# USER: username
# LANG: Python
# TASK: hydrocarbons
for Python coders
Comments