結果

問題 No.2811 Calculation Within Sequence
ユーザー ああいい
提出日時 2024-07-20 19:32:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 206 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 132,120 KB
最終ジャッジ日時 2024-07-20 19:32:46
合計ジャッジ時間 10,811 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

a,b = map(int,input().split())
T = list(map(int,input().split()))
S = list(map(int,input().split()))

def gcd(a,b):
	while b:
		a,b = b,a % b
	return a
	
now = T[0]
for i in range(1,a):
	now = gcd(now,T[i])
import sys
for s in S:
	if s % now != 0:
		print('No')
		exit()
print('Yes')
0