Submission #3159180

Source Code Expand

Copy
N, X = map(int, input().split())
x = list(map(int, input().split()))

xx = [abs(xxx - X) for xxx in x]

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

l = xx[0]
if len(xx) > 1:
    for i in xx[1:]:
        l = gcd(l, i)


print(l)

Submission Info

Submission Time
Task C - Skip
User showyou41
Language Python3 (3.4.3)
Score 300
Code Size 265 Byte
Status
Exec Time 81 ms
Memory 14252 KB

Test Cases

Set Name Score / Max Score Test Cases
All 300 / 300 hand_1, large_1, large_2, large_3, large_4, large_5, large_6, large_7, large_8, max_1, max_2, max_3, min_1, min_2, sample_01, sample_02, sample_03, small_1, small_2, small_3, small_4, small_5
Sample 0 / 0 sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
hand_1 17 ms 2940 KB
large_1 26 ms 4656 KB
large_2 29 ms 5264 KB
large_3 27 ms 4868 KB
large_4 17 ms 3060 KB
large_5 17 ms 2940 KB
large_6 17 ms 3060 KB
large_7 17 ms 3060 KB
large_8 17 ms 3060 KB
max_1 77 ms 14252 KB
max_2 81 ms 14224 KB
max_3 76 ms 14224 KB
min_1 17 ms 3060 KB
min_2 17 ms 2940 KB
sample_01 17 ms 2940 KB
sample_02 17 ms 2940 KB
sample_03 17 ms 3060 KB
small_1 17 ms 3060 KB
small_2 17 ms 3060 KB
small_3 17 ms 2940 KB
small_4 17 ms 3060 KB
small_5 17 ms 2940 KB