101891: [AtCoder]ABC189 B - Alcoholic

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $200$ points

Problem Statement

Takahashi had $N$ glasses of liquor.

The amount and alcohol percentage of the $i$-th liquor were $V_i$ milliliters and $P_i$ percent by volume, respectively.

Takahashi gets drunk when his alcohol intake exceeds $X$ milliliters.

Which of the $N$ liquors was he drinking when he gets drunk? If he was not drunk even after drinking all the liquors, print -1 instead.

Constraints

  • All values in input are integers.
  • $1 \leq N \leq 10^3$
  • $0 \leq X \leq 10^6$
  • $1 \leq V_i \leq 10^3$
  • $0 \leq P_i \leq 100$

Input

Input is given from Standard Input in the following format:

$N$ $X$
$V_1$ $P_1$
$\vdots$
$V_N$ $P_N$

Output

If Takahashi got drunk when drinking the $i$-th liquor, print $i$. If he was not drunk even after drinking all the liquors, print -1 instead.


Sample Input 1

2 15
200 5
350 3

Sample Output 1

2

The $1$-st liquor contains $200\times \dfrac{5}{100}=10$ milliliters of alcohol.

The $2$-nd liquor contains $350\times \dfrac{3}{100}=10.5$ milliliters of alcohol.

His alcohol intake exceeds $15$ milliliters for the first time when drinking the $2$-nd liquor.


Sample Input 2

2 10
200 5
350 3

Sample Output 2

2

When his alcohol intake is exactly $X$ milliliters, he is still not drunk.


Sample Input 3

3 1000000
1000 100
1000 100
1000 100

Sample Output 3

-1

He seems to be immune to alcohol.

Input

题意翻译

### 题目描述 高桥君喝酒喝了$N$杯 第$i$个喝的酒是$V_i$ml,酒精度数是$P_i$ 高桥君的酒精摄取量超过$X$毫升就会喝醉。 高桥君喝醉是在喝第几杯酒的时候?但是,如果喝了$N$杯酒之后还没有喝醉的话,请代替输出`-1`。 ### 输入格式 输入以以下形式从标准输入给出: $N$ $X$ $V_1$ $P_1$:$V_N$ $P_N$ ### 输出格式 高桥君喝醉是在喝了第几杯酒的时候。但是,喝了$N$杯所有的酒之后也没有喝醉的情况,代替输出`-1`。

加入题单

上一题 下一题 算法标签: