← 返回 amazon 的题目列表Minimum Total Travel Time on a Circular Hub Ring
类型:online_judge
Problem: Minimum Total Travel Time on a Circular Hub Ring
Amazon has a circular network of m hubs labeled 1..m, where hub 1 is adjacent to hub m.
A drone can move from any hub to either adjacent hub (clockwise or counterclockwise). You are given a 1-based array transitionTime of length m that defines the travel time associated with moving between neighboring hubs (exact edge-weight definition is as stated in the original prompt).
Amazon receives a sequence of priority requests requestedHubs (length n, each in 1..m). The drone starts at hub 1 and must visit requestedHubs[1], requestedHubs[2], ..., requestedHubs[n] in order.
Compute the minimum total travel time required to fulfill all requests.
Note: Use 1-based indexing.
Example
m = 3
n = 4
transitionTime = [3, 2, 1]
requestedHubs = [1, 3, 3, 2]
Task
Return the minimum total travel time (integer).
Constraints
Not visible in the screenshot (unknown).
Example
Input
m=3
transitionTime=3 2 1
requestedHubs=1 3 3 2
Output
(以题面边权定义为准,截图未给出期望输出)