Problem:


Score : 500 points

Problem Statement

There are N towns on a line running east-west.
The towns are numbered 1 through N, in order from west to east.
Each point on the line has a one-dimensional coordinate, and a point that is farther east has a greater coordinate value.
The coordinate of town i is X_i.

You are now at town 1, and you want to visit all the other towns.
You have two ways to travel:

Walk on the line.
Your fatigue level increases by A each time you travel a distance of 1, regardless of direction.

Teleport to any location of your choice.
Your fatigue level increases by B, regardless of the distance covered.

Find the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.

Constraints

All input values are integers.

2≤N≤10^5

1≤X_i≤10^9

For all i(1≤i≤N-1), X_i<X_{i+1}.

1≤A≤10^9

1≤B≤10^9

Input

The input is given from Standard Input in the following format:

N A B
X_1 X_2 ... X_N

Output

Print the minimum possible total increase of your fatigue level when you visit all the towns.

Sample Input 1

4 2 5
1 2 5 7

Sample Output 1

11

From town 1, walk a distance of 1 to town 2, then teleport to town 3, then walk a distance of 2 to town 4.
The total increase of your fatigue level in this case is 2×1+5+2×2=11, which is the minimum possible value.

Sample Input 2

7 1 100
40 43 45 105 108 115 124

Sample Output 2

84

From town 1, walk all the way to town 7.
The total increase of your fatigue level in this case is 84, which is the minimum possible value.

Sample Input 3

7 1 2
24 35 40 68 72 99 103

Sample Output 3

12

Visit all the towns in any order by teleporting six times.
The total increase of your fatigue level in this case is 12, which is the minimum possible value.



Sample input:
4 2 5
1 2 5 7


Sample output:
11

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,A,B=map(int,input().split())
    X=list(map(int,input().split()))
    z=B//A
    ans=0
    for i in range(N-1):
        if X[i+1]-X[i]>z:
            ans+=B
        else:
            ans+=(X[i+1]-X[i])*A
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
s=list(map(int,input().split()))
t=0

for i in range(n-1):
	t+=min(b,a*(s[i+1]-s[i]))

print(t)

Submission status: Accepted

Solution code:
N, A, B = map(int,input().split())
X = list(map(int,input().split()))
ans = 0
for i in range(N-1):
    ans += min(A * (X[i+1] - X[i]), B)
print(ans)

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
X=list(map(int,input().split()))
cnt=0
for i in range(N-1):
    if A*(X[i+1]-X[i])>B:
        cnt=cnt+B
    else:
        cnt=cnt+A*(X[i+1]-X[i])
print(cnt)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
x = list(map(int, input().split()))
ans = 0
for i in range(1, n):
    ans += min(a*(x[i]-x[i-1]), b)
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
ns = list(map(int, input().split()))
dis = [ns[i + 1] - ns[i] for i in range(n - 1)]
ttl = 0
for i in range(0, n-1):
    ttl += min(dis[i] * a, b)
print(ttl)

Submission status: Accepted

Solution code:
# solution
import io
nim, mike, kite = map(int, input().split())
array = list(map(int, input().split()))
    
ans = 0
for i in range(1, nim):
    ans += min((array[i] - array[i - 1]) * mike, kite)
print(ans)

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N, A, B = map(int, input().split())
X = list(map(int, input().split()))

ans = 0
for i in range(1, N):
    ans += min((X[i] - X[i - 1]) * A, B)

print(ans)

Submission status: Accepted

Solution code:
def main():
    # import sys
    # readline = sys.stdin.readline
    # readlines = sys.stdin.readlines

    N, A, B = map(int, input().split())
    X = list(map(int, input().split()))

    pos = X[0]
    cnt = 0
    for x in X:
        walk = (x - pos) * A
        tele = B
        if walk < tele:
            cnt += walk
        else:
            cnt += tele
        pos = x
    
    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n, a, b = list(map(int, input().split()))
nums = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    ans += min(a*(nums[i+1]-nums[i]), b)
print(ans)

Submission status: Accepted

Solution code:
def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))

N,A,B = input_multiple_number()
list_X = input_multiple_number_as_list()

ans = 0 
for i in range(1,len(list_X)):
	ans += min((list_X[i]-list_X[i-1])*A,B)

print(ans)

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
X=list(map(int,input().split()))

ans=0
pre=X[0]

for xi in X[1:]:
    if (xi-pre)*A-B>0:
        ans+=B
    else:
        ans+=(xi-pre)*A
    pre=xi

print(ans)

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
X=list(map(int,input().split()))
Y=[0 for k in range(N-1)]
for k in range(N-1):
    Y[k]=X[k+1]-X[k]
ans=0
for k in range(N-1):
    ans+=min(A*Y[k],B)
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
x = list(map(int, input().split()))

cost = 0
cur_x = x[0]
for i in range(1, n):
    cost += min((x[i] - cur_x) * a, b)
    cur_x = x[i]
print(cost)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
arr = list(map(int, input().split()))
ans = 0
for i in range(N-1):
    if (arr[i+1] - arr[i]) * A > B:
        ans += B
    else:
        ans += (arr[i+1] - arr[i]) * A
print(ans)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())

x = list(map(int,input().split()))

diff_x = []

for i in range(1,n):
    diff_x.append((x[i]-x[i-1])*a)

for i in range(n-1):
    if diff_x[i] > b:
        diff_x[i] = b

print(sum(diff_x))

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())
x = list(map(int, input().split()))
ans = 0
for i in range(0,n-1):
    ans += min(a*(x[i+1]-x[i]),b)
print(ans)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
ans=0
for i in range(n-1):
  ans+=min((x[i+1]-x[i])*a,b)
print(ans)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
x = list(map(int,input().split()))
ans = 0
for i in range(n-1):
    walk_i = (x[i+1] - x[i])*a
    tel_i = b
    ans+=min(walk_i,tel_i)
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

X.sort()
ans = 0
for i in range(N-1):
    ans += min((X[i+1] - X[i]) * A, B)
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

X.sort()

group=[[X[0]]]
for i in range(N-1):
    if (X[i+1] - X[i]) * A > B:
        group.append([X[i+1]])
    else:
        group[-1].append(X[i+1])
#print(group)

ans = (len(group) - 1) * B
for g in group:
    ans += (max(g) - min(g)) * A
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
x = list(map(int, input().split()))

xrui = []
ans = 0
for i in range(n-1):
    xrui.append(x[i + 1] - x[i])

for i in xrui:
    if i * a < b:
        ans += i * a
    else:
        ans += b
print(ans)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())     

t = list(map(int,input().split()))

t.sort()

dp=[0]*n

for i in range(1,n):
    dp[i] += dp[i-1]+min((t[i]-t[i-1])*a,b)
print(dp[-1])

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
X=list(map(int,input().split()))
ans=0
for i in range(1,N):
  ans+=min(A*(X[i]-X[i-1]),B)
print(ans)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
x=list(map(int,input().split()))

ans=0
for i in range(n-1):
    ans+=min((x[i+1]-x[i])*a,b)
print(ans)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
xi = [int(i) for i in input().split()]

ans = 0

for i in range(1,n):
    tmp_a = (xi[i] - xi[i-1])*a
    if tmp_a >= b:
        ans += b
    else:
        ans += tmp_a
        
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
x = list(map(int, input().split()))
ans = 0
for i in range(1, n):
    ans += min(b,(x[i] - x[i-1]) * a)
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = tuple(map(int, input().split()))

ans = 0
for i in range(N - 1):
    ans += min((X[i + 1] - X[i]) * A, B)
print(ans)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
X=list(map(int,input().split()))
ans=0
for i in range(n-1):
    if (X[i+1]-X[i])*a>b:
        ans+=b
    else:
        ans+=(X[i+1]-X[i])*a

print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int,input().split())
x = list(map(int,input().split()))
dp = [10**9]*(n+1)
dp[0] = 0
for i in range(n - 1):
    dp[i + 1] = min(dp[i] + a*(x[i + 1]-x[i]), dp[i] + b)
print(dp[n-1])

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
x = list( map(int, input().split()))

ans = 0

for i in range(len(x)-1):
    toho = (x[i+1] - x[i])*a
    if toho <= b:
        ans += toho
    else:
        ans += b

print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
tired = 0
for i in range(N-1):
  tired += min((X[i+1]-X[i])*A,B)
print(tired)

#print(*ans, sep='\n')

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
x = list(map(int,input().split()))

ans=0
for i in range(n-1):
    ans+=min((x[i+1]-x[i])*a,b)

print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = tuple(map(int, input().split()))

current = X[0]

ans = 0
for x in X:
    ans += min((x - current) * A, B)
    current = x

print(ans)

Submission status: Accepted

Solution code:
#052_D
n, a, b = map(int, input().split())
x = list(map(int, input().split()))

ans = 0
for i in range(1, n):
    ans += min(b, (x[i]-x[i-1]) * a)
print(ans)

Submission status: Accepted

Solution code:

import math
import itertools
import statistics
#import collections
n, a, b = list(map(int, input().split()))
x = list(map(int, input().split()))

total = 0
for i in range(n-1):
    if (x[i+1]-x[i])*a < b:
        total += (x[i+1]-x[i])*a
    else:
        total += b

print(total)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
x = sorted(list(map(int,input().split())))
ans = 0
for i in range(n-1):
    ans += min((x[i+1]-x[i])*a,b)
print(ans)

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
a=list(map(int,input().split()))
border=B//A+1
ans=0
for i in range(N-1):
  d=a[i+1]-a[i]
  if d>=border:
    ans+=B
  else:
    ans+=(A*d)
print(ans)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
x = list(map(int,input().split()))
count = 0
for i in range(n-1):
    if a*(x[i+1] - x[i]) > b:
        count += b
    else:
        count += a*(x[i+1] - x[i])
print(count)

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
X = list(map(int,input().split()))

ans = 0
for i in range(1,N):
    if (X[i]-X[i-1])*A > B:
        ans += B
    else:
        ans += (X[i]-X[i-1])*A
print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n,a,b=MI()
    xx=LI()
    now=xx[0]
    ans=0
    for x in xx[1:]:
        if (x-now)*a<b:ans+=(x-now)*a
        else:ans+=b
        now=x
    print(ans)

main()

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
x = list(map(int,input().split()))
ans = 0
now = x[0]
for i in range(n):
    if (x[i] - now)*a >= b:
        ans += b
        now = x[i]
    else:
        ans += (x[i] - now)*a
        now = x[i]
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().rstrip().split())
X = list(map(int, input().rstrip().split()))

count = 0
for i in range(N-1):
    count += min(A*(X[i+1]-X[i]), B)
    
print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n,a,b = map(int,input().split())
X = list(map(int,input().split()))
dis = [0]*(n-1)
for i in range(1,n):
  dis[i-1]= X[i]-X[i-1]
for di in dis:
  if di*a <= b:
    ans += di*a
  else:
    ans += b
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,A,B=MI()
    X=LI()
    ans=0
    for i in range(N-1):
        d=X[i+1]-X[i]
        ans+=min(d*A,B)
        
    print(ans)

main()

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())

x = list(map(int, input().split())) 

cost = 0
for i in range(n-1):
    length = x[i+1] - x[i]
    if length*a < b:
        cost += length*a
    else:
        cost += b
print(cost)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
c = list(map(int, input().split()))

ans = 0
for i in range(n-1):
    ans += min((c[i+1] - c[i]) * a, b)
print(ans)

Submission status: Accepted

Solution code:
N,A,B = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
ans = 0
for i in range(1,N):
    ans += min(abs(X[i]-X[i-1])*A,B)
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
x = list(map(int, input().split()))

ans = 0
for e1, e2 in zip(x, x[1:]):
    walk = (e2 - e1) * a
    ans += min(walk, b)

print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
x = list(map(int, input().split()))

ans = 0
for e1, e2 in zip(x, x[1:]):
    walk = (e2 - e1) * a
    if walk <= b:
        ans += walk
    else:
        ans += b

print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
x = list(map(int, input().split()))
c = 0
for i in range(1, n):
    if a * (x[i] - x[i - 1]) <= b:
        c += a * (x[i] - x[i - 1])
    else:
        c += b
print(c)

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest

doTest=0

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline
    n,a,b=list(map(int, readline().strip().split()))
    xx=list(map(int, readline().strip().split()))
    p=0
    for i in range(1,len(xx)):
        d=xx[i]-xx[i-1]
        p+=min(d*a,b)
    #n,m,k=list(map(int, readline().strip().split()))
    #arr=list(map(int, readline().strip().split()))
    #n=int(readline().strip())
    print(p)

    return

if doTest==0:
    resolve()
    sys.exit()

### ----------------
### ここまでコピぺえ 
### ----------------

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())
x = list(map(int,input().split()))

ans = 0
for i in range(n-1):
  ans += min(a*(x[i+1]-x[i]), b)
  
print(ans)

Submission status: Accepted

Solution code:
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    N,A,B = map(int, input().split())
    X = list(map(int, input().split()))
    res = 0
    for i in range(N-1):
        if (X[i+1]-X[i])*A>B:
            res += B
        else:
            res += (X[i+1]-X[i])*A
    print(res)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, a, b = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
h = 0
for i in range(n- 1):
    if (x[i + 1] - x[i]) * a >= b:
        h += b
    else:
        h += (x[i + 1] - x[i]) * a
print(h)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

nowX = X[0]
ans = 0
for x in X[1:]:
    ans += min((x-nowX)*A, B)
    nowX = x
print(ans)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc052/tasks/arc067_b
# 歩いたほうが良いのかテレポートしたほうが良いのか貪欲に選択していくだけでは？

import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))



N, A, B = read_ints()
X = read_ints()

# 面倒なのでnumpy芸してええか？
X_diff = [x-y for x,y in zip(X[1:],X[:-1])]
ans = 0
for d in X_diff:
    ans += min(B, d * A)
print(ans)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc052/tasks/arc067_b
# 歩いたほうが良いのかテレポートしたほうが良いのか貪欲に選択していくだけでは？

import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


import numpy as np
N, A, B = read_ints()
X = read_ints()

# 面倒なのでnumpy芸してええか？
X_diff = np.diff(X)
ans = 0
for d in X_diff:
    ans += min(B, d * A)
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
 
N, A, B = [int(x) for x in input().split()]
X = [int(x) for x in input().split()]

ans = 0

for i in range(N - 1):
    if (X[i + 1] - X[i]) * A > B:
        ans += B
    else:
        ans += (X[i + 1] - X[i]) * A

print(ans)

Submission status: Accepted

Solution code:
N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))

DP = [0] * N

for i in range(1, N):
    DP[i] = min((X[i] - X[i-1]) * A, B) + DP[i-1]

print(DP[N-1])

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

ans = 0

for n in range(N-1):
  if (X[n+1] - X[n]) * A > B:
    ans += B
  else:
    ans += (X[n+1] - X[n]) * A

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, A: int, B: int, X: "List[int]"):
    print(sum(
        min((xj - xi) * A, B)
        for xi, xj in zip(X, X[1:])
    ))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    X = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A, B, X)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
x=list(map(int,input().split()))

tired=0
for i in range(n-1):
    if a*(x[i+1]-x[i])<=b:
        tired+=a*(x[i+1]-x[i])
    else:
        tired+=b
print(tired)

Submission status: Accepted

Solution code:
def main():
    towns, walk_fatigue, teleport_fatigue = map(int, input().split())
    town_location = list(map(int, input().split()))
    answer = 0
    for i in range(towns - 1):
        answer += min(teleport_fatigue, walk_fatigue * (town_location[i + 1] - town_location[i]))
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, A, B, *X = map(int, open(0).read().split())
ans = sum(min((X[i]-X[i-1])*A,B) for i in range(1,N))
print(ans)

Submission status: Accepted

Solution code:
N, A, B, *X = map(int, open(0).read().split())
Y = []
ans = sum(min((X[i]-X[i-1])*A,B) for i in range(1,N))
print(ans)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
x = list(map(int,input().split()))

ans = 0

for i in range(n-1):
    ans += min(b, a * (x[i+1] - x[i]))

print(ans)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
l = list(map(int,input().split()))
ans = 0

for i in range(1,n):
  if (l[i]-l[i-1])*a >= b:
    ans += b
  else:
    ans += (l[i]-l[i-1])*a
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
x = list(map(int, input().split()))
now = x[0]
ans = 0
for i in range(1, n):
    ans += min(a*(x[i] - now), b)
    now = x[i]
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

ans = 0
for i in range(1, N):
    d = X[i] - X[i-1]
    ans += min(d * A, B)

print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = tuple(map(lambda x: int(x) * A, input().split()))
print(sum(min(X[i] - X[i - 1], B) for i in range(1, N)))

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
*x, = map(int, input().split())
ans = 0
for i in range(1, N):
    ans += min([(x[i]-x[i-1])*A, B])
print(ans)

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
List = list(map(int,input().split()))
cost = []
for i in range(N-1):
  cost.append(min(A*(List[i+1]-List[i]),B))
Answer = sum(cost)
print(Answer)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
dist = []
ans = 0

for i in range(N - 1):
	dist.append(X[i + 1] - X[i])
	
for i in range(N - 1):
	ans += min(dist[i] * A, B)
	
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
x = list(map(int, input().split()))
ans = 0
for i in range(1, N):
    ans += min((x[i] - x[i - 1]) * A, B)

print(ans)

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
X=list(map(int,input().split()))
ret = 0
for i in range(1,N):
  ret += min(B, A*(X[i]-X[i-1]))
print(ret)

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
X=list(map(int,input().split()))
import numpy as np
X=np.array(X)
print(sum(np.minimum((X[1:]-X[:N-1])*A , B)))

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
X = [int(x) for x in input().split()]

ans = 0
for i in range(1,N):
	d = X[i]-X[i-1]
	ans += min(A*d, B)
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
for i in range(1, N):
  ans += min(A*(X[i]-X[i-1]), B)
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

N, A, B = map(int, input().split())
X = list(map(int, input().split()))

ans = 0

for i in range(len(X) - 1):
    if (X[i + 1] - X[i]) * A > B:
        ans += B
    else:
        ans += (X[i + 1] - X[i]) * A

print(ans)

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
X=list(map(int,input().split()))
ans=0
for i in range(1,N):
    a=X[i]-X[i-1]
    b=a*A
    if b<B:
        ans+=b
    else:
        ans+=B
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
    d = (X[i + 1] - X[i]) * A
    if d < B:
        ans += d
    else:
        ans += B

print(ans)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
xx = list(map(int,input().split()))

ans = 0
for i in range(n-1):
  ans += min((xx[i+1]-xx[i])*a, b)
print(ans)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
xs=list(map(int,input().split()))
l=[xs[i+1]-xs[i] for i in range(n-1)]
ans=[a*k if a*k < b else b for k in l]
print(sum(ans))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    N, A, B = [int(x) for x in input().split()]
    X = [int(x) for x in input().split()]

    ans = 0
    for i, j in zip(X, X[1:]):
        ans += min((j - i) * A, B)

    print(ans)

    
    
    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,a,b,*towns=map(int,open(0).read().split())

fatigue=0
for i in range(n-1):
    fatigue+=min(b,a*(towns[i+1]-towns[i]))
    
print(fatigue)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
towns = list(map(int,input().split()))

fatigue = 0
for i in range(n-1):
  d = towns[i+1] -towns[i]
  fatigue += min(d*a,b)
print(fatigue)

Submission status: Accepted

Solution code:
N,a,b=map(int,input().split())
X=list(map(int,input().split()))
cnt=0
for i in range(N-1):
  d=X[i+1]-X[i]
  if d*a>b:
    cnt+=b
  else:
    cnt+=d*a
print(cnt)

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())
x = list(map(int, input().split()))
diff = [x[i+1] - x[i] for i in range(n-1)]
ans = 0
for i in range(1,n):
    if diff[i-1] * a > b:
        ans += b
    else:
        ans += diff[i-1] * a
# print(diff)
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

diffs = []
for i in range(len(X) - 1):
    left, right = X[i], X[i + 1]
    diffs.append(right - left)
costs = []
for diff in diffs:
    costs.append(min(diff * A, B))
print(sum(costs))

Submission status: Accepted

Solution code:
N, A, B = map(int , input().split())
X = list(map(int,input().split()))
now = X[0]
ans = 0
for i in range(1, len(X)):
    if (X[i] - now) * A > B:
        ans += B
    else:
        ans += (X[i] - now) * A
    now = X[i]
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
x = list(map(int, input().split()))

hp = 0
good = min(a, b)
bad = max(a, b)

if good == a:
  for i in range(n):
    if i+1 == n:
      break
    if bad >= abs(x[i+1] - x[i])*good:
      hp += abs(x[i+1] - x[i]) * good
    else:
      hp += bad

else:
  for i in range(n):
    if i+1 == n:
      break
    if good >= abs(x[i+1] - x[i])*bad:
      hp += abs(x[i+1] - x[i]) * bad
    else:
      hp += good
print(hp)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
x=list(map(int,input().split()))

ans=0
for i in range(1,n):
 ans+=min((x[i]-x[i-1])*a,b)
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
dist = [x2 - x1 for x1, x2 in zip(X, X[1:])]
print(sum(min(B, A*d) for d in dist))

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
x = list(map(int, input().split()))

ans = 0
for i in range(1, n):
    if a * (x[i]-x[i-1]) < b:
        ans += a * (x[i]-x[i-1])
    else:
        ans += b
print(ans)

Submission status: Accepted

Solution code:
# D - Walk and Teleport
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
dist=[]

for i in range(n-1):
    dist.append(x[i+1]-x[i])
ans=0
for i in range(len(dist)):
    if dist[i]*a<b:
        ans+=dist[i]*a
    else:
        ans+=b
print(ans)

Submission status: Accepted

Solution code:
N,A,B=map(int,raw_input().split())
X=map(int,raw_input().split())
print sum(min(B,A*(X[i+1]-X[i]))for i in range(N-1))

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
pos = X[0]
for i in range(1, N):
    ans += min(A * (X[i] - pos), B)
    pos = X[i]
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, A: int, B: int, X: "List[int]"):
    tot = 0
    for i in range(N-1):
        sub = X[i+1]-X[i]
        if sub*A < B:
            tot += sub*A
        else:
            tot += B
    print(tot)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    X = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A, B, X)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def solve():
    N, A, B = map(int, input().split())
    Xi = tuple(map(int, input().split()))

    # print(N, "\n徒歩疲労度", A, "\nテレポ疲労度", B)
    # print(Xi)

    total = 0
    for i in range(1, N):
        total += min((Xi[i] - Xi[i - 1]) * A, B)

    return total


if __name__ == '__main__':
    res = solve()
    print(res)

Submission status: Accepted

Solution code:
# ABC052D
N, A, B = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
thres = B // A
for i in range(N-1):
    x = X[i+1] - X[i]
    if x > thres:
        ans += B
    else:
        ans += A * x
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
*x, = map(int, input().split())

ans = 0
for i in range(n-1):
    ans += min(abs(x[i+1]-x[i])*a, b)
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

fatigue = 0
for i in range(N-1):
    fatigue += min((X[i+1]-X[i])*A, B)

print(fatigue)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
res = 0
for i in range(n-1):
    t = x[i+1]-x[i]
    res += min(t*a,b)
print(res)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
n,a,b=map(int,input().split())
X=list(map(int,input().split()))
ans=0
for i in range(n-1):
    ans+=min((X[i+1]-X[i])*a,b)
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

ans = 0
for i in range(N-1):
    dist = X[i+1] - X[i]
    if dist * A <= B:
        ans += dist * A
    else:
        ans += B
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int,input().split())
X = [int(i) for i in input().split()]
p = X[0]
ans = 0
for i in range(1, N):
  ans += min(B, A*(X[i]-p))
  p = X[i]
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
L = list(map(int, input().split()))
D = [A * (L[i+1] - L[i]) for i in range(N - 1)]
S = 0
for i in range(N - 1):
  if D[i] > B:
    S += B
  else:
    S += D[i]
print(S)

Submission status: Accepted

Solution code:
[n,a,b]=list(map(int,input().split()))
xlist=list(map(int,input().split()))
ans=0
for i in range(1,n):
    walk=(xlist[i]-xlist[i-1])*a
    if (walk<b): #歩いたほうが楽
        ans+=walk
    else:
        ans+=b
ans=int(ans)
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, X, Y = MAP()
A = LIST()

ans = 0
for i in range(N-1):
    ans += min((A[i+1] - A[i]) * X, Y)
print(ans)