結果

問題 No.2244 Integer Complete
ユーザー shobonvipshobonvip
提出日時 2023-03-08 05:30:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,069 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 81,628 KB
実行使用メモリ 85,672 KB
最終ジャッジ日時 2023-10-18 05:48:50
合計ジャッジ時間 4,968 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
57,816 KB
testcase_01 AC 38 ms
53,364 KB
testcase_02 AC 38 ms
53,364 KB
testcase_03 AC 38 ms
53,364 KB
testcase_04 AC 38 ms
53,364 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 38 ms
53,364 KB
testcase_09 AC 38 ms
53,364 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 39 ms
53,364 KB
testcase_14 AC 40 ms
53,364 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 58 ms
75,796 KB
testcase_18 AC 59 ms
75,796 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect


def makediv(n):
	lower_divisors , upper_divisors = [], []
	i = 1
	while i*i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n//i)
		i += 1
	return lower_divisors + upper_divisors[::-1]


n, m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

assert 1 <= n <= 30000
assert 1 <= m <= 30000

for i in range(n):
	assert 1 <= a[i] <= 30000

for i in range(m):
	assert 1 <= b[i] <= 30000

for i in range(n-1):
	assert a[i] < a[i+1]

for i in range(m-1):
	assert b[i] < b[i+1]

a2 = [a[i] * a[i] for i in range(n)]
b2 = [b[i] * b[i] for i in range(m)]

if a[0] != 1 or b[0] != 1:
	print(1)
	exit()

k = max(max(a), max(b)) ** 2
while True:
	mode = 0
	for i in makediv(k):
		j = k // i
		ar = 0
		for x in range(n):
			if a[x] ** 2 <= i < (a[x] + 1) ** 2:
				ar = 1
				break
		if ar == 0: continue
		ar = 0
		for y in range(m):
			if b[y] ** 2 <= j < (b[y] + 1) ** 2:
				ar = 1
				break
		if ar == 1:
			mode = 1
			break
	if not mode:
		break
	k += 1

print(k)
0