結果

問題 No.2811 Calculation Within Sequence
ユーザー flippergo
提出日時 2025-06-07 20:37:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 316 bytes
コンパイル時間 1,351 ms
コンパイル使用メモリ 82,352 KB
実行使用メモリ 132,576 KB
最終ジャッジ日時 2025-06-07 20:37:54
合計ジャッジ時間 10,922 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
a,b = map(int,input().split())
T = list(map(int,input().split()))
S = list(map(int,input().split()))
t = T[0]
for i in range(1,a):
    t = gcd(t,T[i])
s = S[0]
for i in range(1,b):
    s = gcd(s,S[i])
if s%t==0:
    print("Yes")
else:
    print("No")
0