Problem:


Score : 300 points

Problem Statement

There are N cities on a number line. The i-th city is located at coordinate x_i.

Your objective is to visit all these cities at least once.

In order to do so, you will first set a positive integer D.

Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like:

Move 1: travel from coordinate y to coordinate y + D.

Move 2: travel from coordinate y to coordinate y - D.

Find the maximum value of D that enables you to visit all the cities.

Here, to visit a city is to travel to the coordinate where that city is located.

Constraints

All values in input are integers.

1 \leq N \leq 10^5

1 \leq X \leq 10^9

1 \leq x_i \leq 10^9

x_i are all different.

x_1, x_2, ..., x_N \neq X

Input

Input is given from Standard Input in the following format:

N X
x_1 x_2 ... x_N

Output

Print the maximum value of D that enables you to visit all the cities.

Sample Input 1

3 3
1 7 11

Sample Output 1

2

Setting D = 2 enables you to visit all the cities as follows, and this is the maximum value of such D.

Perform Move 2 to travel to coordinate 1.

Perform Move 1 to travel to coordinate 3.

Perform Move 1 to travel to coordinate 5.

Perform Move 1 to travel to coordinate 7.

Perform Move 1 to travel to coordinate 9.

Perform Move 1 to travel to coordinate 11.

Sample Input 2

3 81
33 105 57

Sample Output 2

24

Sample Input 3

1 1
1000000000

Sample Output 3

999999999



Sample input:
3 3
1 7 11


Sample output:
2

Submission status: Wrong Answer

Solution code:
import subprocess
import gzip, base64, os
import stat

gz = b'H4sIAFz1Y10C/719C3xTRdb4TfoKBZoWEcs7YMQiUlpaoBUfaWngBlOotDxWwdCmKVTbpl+TQHFR0bYuMVZZlp/LvnH3+1zXTz/9/PZzkVUogi2ujwUV5CEvFb2hPOoLqij5nzMzN5l7c28F1/8XpZNz5szMOWfOnDkz92bmfrtzptFgEOSPUbhZQChjpI3ANobf6I6SAK5A6Ad/RwsjhGSAkzg6m2BTpL2sajk1MboE+JcI/wqMFC4w2hTpCEYnpwYuTRL4j02RblwiKFJBsETLIa/7GX7/kqWK1JJI8WUpynJGVq6Xletl9HIqGAVFKsuXyP5VMHwFk0tOSxhdCUdP2j/hr8bvaxdSeO1CmyJdzehWq8rdBuWShU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LLezUcxA+73Fs19D3eGrU5Ra9AV0pAwoEfdsG2qk3y26Y4E7rk+63jB/KPdVG9RswwjY8ZiJms0HMkOreSa1kKd615nKHp3IwdF4R4yCtxWleXx9vuj3ChtsbsrKEIptk4b6u4xRry2K3S6mvv4ztAvsFcI1Kjt4lrMKG+oD1+PDWuiplfbn78rdzq4Ke2QaDO9f8BjChBvwyMAAA='
bin = gzip.decompress(base64.b64decode(gz))
pymain = os.path.join(os.path.dirname(__file__), 'pymain')
with open(pymain, 'wb') as f:
    f.write(bin)
os.chmod(pymain, stat.S_IXUSR | stat.S_IXGRP)
cmd = pymain
subprocess.call(cmd.split())

Submission status: Wrong Answer

Solution code:
from fractions import gcd


N, X = map(int, input().split())
xs = sorted(map(int, input().split()))
diffs = []
for a, b in zip(xs, xs[1:]):
    diffs.append(b - a)

gcds = [0]
for i in range(N - 1):
    gcds.append(gcd(gcds[i], diffs[i]))
print(gcds[-1])

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from functools import reduce
n, x = map(int, input().split())
X = list(map(int, input().split()))
X.append(x)
minn = min(X)

def rgcd(nums):
  return reduce(gcd, nums)
arr_X = [X[i]-minn for i in range(n)]
print(rgcd(arr_X))

Submission status: Wrong Answer

Solution code:
n, x = map(int, input().split())
X = list(map(int, input().split()))
X.append(x)
X = sorted(X)
dif = []
for i in range(len(X)-1):
  dif.append(abs(X[i]-X[i+1]))
  
print(min(dif))

Submission status: Wrong Answer

Solution code:
import fractions

def main():
    N, X = map(int, input().split())
    x = list(map(int, input().split()))

    sort_x = sorted(x)
    diff = [0] * N
    for i in range(N):
        diff[i] = abs(X - sort_x[i])

    ans = diff[0]

    for i in range(1, N - 1):
        ans = fractions.gcd(ans, diff[i])

    print(ans)

    


main()

Submission status: Wrong Answer

Solution code:
import fractions

def main():
    N, X = map(int, input().split())
    x = [X] + list(map(int, input().split()))

    sort_x = sorted(x)
    diff = [0] * N
    for i in range(N):
        diff[i] = sort_x[i + 1] - sort_x[i]

    ans = diff[0]

    for i in range(1, N - 1):
        ans = fractions.gcd(ans, diff[i])

    print(ans)

    


main()

Submission status: Wrong Answer

Solution code:

N, X = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
x.append(10**9+1)

# Xの挿入場所を探す
len_x = len(x)
A = []
is_append = False
for i in range(len_x-1):
    A.append(x[i])
    if is_append == False and X <= x[i+1]:
        A.append(X)
        is_append = True

ans = (10 ** 9)+1
for i in range(len(A)-1):
    diff = abs(A[i+1] - A[i])
    ans = min(diff, ans)

print(ans)

Submission status: Wrong Answer

Solution code:

N, X = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
x.append(10**9+1)

# Xの挿入場所を探す
len_x = len(x)
A = []
is_append = False
for i in range(len_x-1):
    A.append(x[i])
    if is_append == False and X <= x[i+1]:
        A.append(X)
        is_append = True

ans = 10 ** 9
for i in range(len(A)-1):
    diff = abs(A[i+1] - A[i])
    ans = min(diff, ans)

print(ans)

Submission status: Wrong Answer

Solution code:
n,X=map(int,input().split())
x=list(map(int,input().split()))
if n==1:
    print(abs(x[0]-X))
else:
    x.append(X)
    x.sort()
    z=[]
    for i in range(n):
        z.append(x[i+1]-x[i])
    ans=1
    import fractions
    for j in range(n-1):
        ans=fractions.gcd(z[j],z[j+1])
    print(ans)

Submission status: Wrong Answer

Solution code:
import fractions as math

n, x = map(int, input().split())
a = list(map(int, input().split()))
a.append(x)
a.sort()
print(a)
gcd = a[1] - a[0]
for i in range(2, n+1):
    d = a[i] - a[i - 1]
    gcd = math.gcd(gcd, d)
print(gcd)

Submission status: Wrong Answer

Solution code:
import fractions as math

n, x = map(int, input().split())
a = list(map(int, input().split()))
a.append(x)
a.sort()
# print(a)
gcd = a[1] - a[0]
for i in range(2, n):
    d = a[i] - a[i - 1]
    gcd = math.gcd(gcd, d)
print(gcd)

Submission status: Wrong Answer

Solution code:
N, X = map(int, input().split())
cities = [int(i) for i in input().split()]
cities.sort()
dist = [int(abs(i-X)) for i in cities]
dist.sort()
print(dist)
 
if N==1:
    print(max(dist))
else:
    while len(dist)>0:
        m = min(dist)
        dist = [int(i%m) for i in dist]
        dist.sort()
        while len(dist)>0 and dist[0]==0:
            dist.remove(0)
        if len(dist)==0:
            break
        else:
            dist.append(m)
    print(m)

Submission status: Wrong Answer

Solution code:
from fractions import gcd
from functools import reduce


def gcd_list(numbers):
    return reduce(gcd, numbers)


def resolve():
    n, x = list(map(int, input().split()))
    xxx = list(map(int, input().split()))
    xxx = [abs(i-x) for i in xxx]
    print(gcd_list(xxx))

Submission status: Wrong Answer

Solution code:
N,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x = sorted(x)
dist = []
from fractions import gcd
if N != 1:
    for i in range(1,N):
        dist.append(x[i] - x[i-1])
        if i == 1:
            ans = dist[0]
        elif i > 1:
            ans = gcd(ans, dist[-1])
else:
    ans = x[1] - x[0]
print(ans)

Submission status: Wrong Answer

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

ans = abs(axis[0] - X)

def gcd(n, m) :
    n, m = max(n, m), min(n, m)
    if n % m == 0 :
        return m
    return gcd(n // m, n % m)

for a in axis :
    ans = gcd(ans, abs(a - X))

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

N, X = map(int, input().split())
nums = list(map(int, input().split()))
nums.append(X)
nums.sort()
nums = [i - X for i in nums]
ans = sys.maxsize
for i in range(len(nums)-1):
    diff = abs(nums[i+1] - nums[i])
    ans = min(diff, ans)

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

N, X = map(int, input().split())
nums = list(map(int, input().split()))
nums.append(X)
nums.sort()
nums = [i - X for i in nums]
ans = sys.maxsize
for i in range(len(nums)-1):
    diff = nums[i+1] - nums[i]
    ans = min(diff, ans)

print(ans)

Submission status: Wrong Answer

Solution code:
N, X = map(int, input().split())
nums = list(map(int, input().split()))
nums = [abs(i - X) for i in nums]
print(min(nums))

Submission status: Wrong Answer

Solution code:
import fractions
from functools import reduce

def main():

    N,X= map(int,input().split())
    targetList = list(map(int,input().split()))
    targetList.append(X)
    targetList.sort()
    diffList = []

    if N !=1:

        for i in range(N-1):
            diffList.append(targetList[i+1] - targetList[i])
    else:
        print(abs(targetList[0]-targetList[1]))
        exit()


    print(reduce(fractions.gcd,diffList))

        
    
if __name__== "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N, X = map(int, input().split())
lst = list(map(int, input().split()))
update_lst = [abs(X - i) for i in lst]
print(min(update_lst))

Submission status: Wrong Answer

Solution code:
N, X = map(int, input().split())
lst = list(map(int, input().split()))
min_lst = min(lst)
max_lst = max(lst)
ans = min(abs(X - min_lst), abs(X - max_lst))
print(ans)

Submission status: Wrong Answer

Solution code:
N, X = map(int, input().split())
L = [int(i) for i in input().split()]

def gcd(x, y):
    while(y > 0):
        x, y = y, x%y
    return int(x)

l = X - L[0]
L.sort()
if N > 1:
    D = [L[i] - L[i-1] for i in range(1, N)]
    for i in range(N-1):
        l = gcd(l, D[i])

print(l)

Submission status: Wrong Answer

Solution code:
# -*- coding: UTF-8 -*-
# ABC109_C


def LCM(num1, num2):
    m = max(num1, num2)
    n = min(num1, num2)
    r = m % n
    while(r != 0):
        m = n
        n = r
        r = m % n
    return n


N, x = map(int, input().split())
D = 1

if (N == 1):
    tmp = int(input())
    print(abs(x - tmp))
else:
    tmp = input()
    list = []
    list = tmp.split()
    for i in range(N):
        list[i] = abs(x - int(list[i]))
    D = list[0]
    for i in range(N):
        D = LCM(D, list[i])

print(D)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    if (a * b) % 2:
        print("Yes")
    else:
        print("No")
    return

#B
def B():
    n = II()
    w = SR(n)
    d = []
    for i in w:
        d.append("".join(i))
    if len(set(d)) != n:
        print("No")
        return
    for i in range(n - 1):
        if w[i][-1] != w[i + 1][0]:
            print("No")
            return
    print("Yes")
    return

#C
def C():
    def gcd(a, b):
        a, b = max(a, b), min(a, b)
        while b:
            a, b = b, a % b
        return a
    n, x = LI()
    xn = LI()+[x]
    xn.sort()
    ans = xn[1] - xn[0]
    for i in range(1, n):
        ans = max(ans, gcd(ans, xn[i + 1] - xn[i]))
    print(ans)
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    if (a * b) % 2:
        print("Yes")
    else:
        print("No")
    return

#B
def B():
    n = II()
    w = SR(n)
    d = []
    for i in w:
        d.append("".join(i))
    if len(set(d)) != n:
        print("No")
        return
    for i in range(n - 1):
        if w[i][-1] != w[i + 1][0]:
            print("No")
            return
    print("Yes")
    return

#C
def C():
    def gcd(a, b):
        a, b = max(a, b), min(a, b)
        while b:
            a, b = b, a % b
        return a
    n, x = LI()
    xn = LI()
    xn = list(map(lambda y: abs(y - x), xn))
    xn.sort()
    ans = xn[0]
    for i in range(1, n):
        ans = max(ans, gcd(ans, xn[i]))
    print(ans)
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
#ABC109C
import sys

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
n=hoge[0]
x=hoge[1]

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

res = abs(x-hoge[0])
print(res)
for i in range(1,n):
	res=gcd(res, abs(hoge[i]-hoge[i-1]))
print(res)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
#ABC109C
import sys

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
n=hoge[0]
x=hoge[1]

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

res = x-hoge[0]
for i in range(1,n):
	res=gcd(res, hoge[i]-hoge[i-1])
print(res)