10730: Гра з монстрами - 1


Відправити розв'язок

Бали: 100 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
Brain****, C++, Java, Pascal, Python, v8js

You are playing a game that consists of \(n\) levels. Each level has a monster. On levels \(1,2,…,n−1\) , you can either kill or escape the monster. However, on level \(n\) you must kill the final monster to win the game.

Killing a monster takes \(s*f\) time where \(s\) is the monster's strength and \(f\) is your skill factor (lower skill factor is better). After killing a monster, you get a new skill factor. What is the minimum total time in which you can win the game?

Формат вхідних даних

The first input line has two integers \(n\) and \(x\) : the number of levels and your initial skill factor.

The second line has \(n\) integers \(s1,s2,…,sn\) : each monster's strength.

The third line has \(n\) integers \(f1,f2,…,fn\) : your new skill factor after killing a monster.

\(1 \le n \le 2*10^5\)

\(1 \le x \le 10^6\)

\(1 \le s1 \le s2 \le ⋯ \le sn \le 10^6\)

\(x \ge f1 \ge f2 \ge ⋯ \ge fn \ge 1\)

Формат вихідних даних

Print one integer: the minimum total time to win the game.

Приклад вхідних даних-1

5 100
20 30 30 50 90
90 60 20 20 10

Приклад вихідних даних-1

4800

Коментарі

Ще немає коментарів.