-->
当前位置:首页 > 题库

PROGRAMMING:Olympic rankings

Luz5年前 (2021-05-10)题库465
Every year, the major media of the Olympic Games will publish a ranking, but careful readers find that the ranking of different countries is slightly different. For example, when China ranks first in the total number of gold medals, the Chinese media will announce the "gold medal list"; The total number of medals in the United States is the first, so the American media announced the "medal list". If a country with a small population publishes a "medal list per capita", maybe African countries will become the top of the list... Now please write a program to calculate the ranking of each country that comes to consult in the most favorable way.
###Input format:
The first line of input gives two positive integers, $$n $$and $$M $$($$Le 224 $$, because there are 224 countries and regions in the world), which are the total number of countries and regions participating in the ranking and the number of countries coming to consult. For simplicity, we number countries from 0 ~ $$n-1 $$. After that, there is a $$n $$line to input, and the number of gold medals, medals and national population (in millions) of the country with the number of $$I-1 $) is given in line $$I $. The numbers are all integers in the [01000] range, separated by spaces. The last line gives the number of $$M $$countries consulted, separated by spaces.
###Output format:
In one line, output the ranking of the countries that came for consultation in order: calculation method number. Its ranking is calculated according to the most favorable way for the country; The calculation method number is: gold medal list = 1, medal list = 2, national per capita gold medal list = 3, national per capita medal list = 4. The output should be separated by spaces, and there should be no extra spaces at the end of the output.
If a country has the same ranking under different ranking methods, the calculation method with the smallest number will be output.
###Input example:
```in
4 4
51 100 1000
36 110 300
6 14 32
5 18 40
0 1 2 3
```
###Output example:
```out
1:1 1:2 1:3 1:4
```






answer:If there is no answer, please comment