logo AlgoBeat OnlineJudge
登录 注册

#213913. [SWERC 2023] Favourite dish

内存限制:128 MiB 时间限制:4000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

:::align{center}

:::

France is a country of gastronomy. For a dish, both the taste and plating are important. Nevertheless, when different people evaluate a dish, some focus more on taste and some focus more on plating. At the Olympic Village dining hall, there are dishes, numbered from 1 to ; each dish has a score on its taste and a score on its plating. There are also persons, numbered from 1 to ; each person has a weight on taste and a weight on plating. One person's final score of a dish is the weighted average of the dish's scores on taste and plating.

The chefs at the Olympics want to provide everyone with their favourite dish on the evening of the closing ceremony. Your task is to calculate everyone's favourite dish. If multiple dishes tie for the highest score as a person's favourite, choose the one with the smallest number.

输入格式

Each line contains two space-separated integers. The first line contains the numbers and . Then follow lines; the such line contains two integers and , which are the scores of the dish on taste and on plating. Then come more lines; the such line contains two integers and , which are the weights of person on taste and on plating.

Limits

  • ;
  • ;
  • , and for all ;
  • , and for all ;
  • the pairs are pairwise distinct;
  • the pairs are pairwise distinct.

输出格式

The output should contain lines. The such line should contain one number: the number of the favourite dish of person .

样例

样例输入 1

4 3
2 5
3 4
4 2
1 6
6 4
2 8
5 5

样例输出 1

2
4
1

样例输入 2

3 4
1 0
0 2
0 1
1 1
2 2
2 1
1 0

样例输出 2

2
2
1
1

数据范围与提示

Sample Explanation 1

Here is the score table for each person on each dish. Each person's favourite dish is indicated with a ; person 3 has three tied favourite dishes, so we chose the first one.

Dish <
Person 1 2 3 4
1
2
3

Sample Explanation 2

Here is the score table for each person on each dish. Each person's favourite dish is indicated with a .

Dish <
Person 1 2 3
1
2
3
4