Highest
시간 제한5초메모리 제한2048 MB
각 질의 (A,B)마다 1의 비용으로 v[i]층까지, 2의 비용으로 w[i]층까지 오를 수 있을 때 A층에서 B층까지 가는 최소 비용을 구한다.
문제
In an alternate universe, Vlad is stuck inside a futuristic version of the Poenari Fortress, now spanning floors, numbered through . From each floor (), he can only go up, either by taking the stairs and paying drop of blood (this is the currency that vampires use to pay in Romania), or by turning into a bat and traversing the vents, for which he has to pay drops of blood. The stairs can take him up to floors upwards, while the vents span up to floors upwards, where and are two given arrays: and .
Formally, from floor (), Vlad can go:
- anywhere from floor to floor without exceeding , for a cost of
- anywhere from floor to floor without exceeding , for a cost of
Furthermore, his brothers Radu and Mircea proposed scenarios for Vlad, each one consisting of two floors and (). Vlad has to answer their questions: what is the least amount of blood that he has to sacrifice to get from floor to floor ?
제한
- .
- for all .
- for all queries.
예제
이 문제는 공개된 예제가 없습니다.