You are viewing a single comment's thread. Return to all comments →
SPOILER SOLUTION
from math import gcd from functools import reduce n, q = map(int, input().split()) arr = list(map(int, input().split())) ans = reduce(gcd, arr) for _ in range(q): offset = int(input()) if ans != arr[0]: print(gcd(ans, offset)) else: print(ans+offset)
Seems like cookies are disabled on this browser, please enable them to open this website
Salary Blues
You are viewing a single comment's thread. Return to all comments →
SPOILER SOLUTION