結果

問題 No.2244 Integer Complete
ユーザー shobonvipshobonvip
提出日時 2023-02-23 20:55:28
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 959 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 81,896 KB
実行使用メモリ 78,532 KB
最終ジャッジ日時 2023-10-18 05:48:21
合計ジャッジ時間 6,933 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,876 KB
testcase_01 AC 40 ms
53,576 KB
testcase_02 AC 39 ms
53,876 KB
testcase_03 AC 38 ms
53,876 KB
testcase_04 AC 40 ms
53,876 KB
testcase_05 AC 40 ms
53,876 KB
testcase_06 AC 39 ms
53,876 KB
testcase_07 AC 39 ms
53,876 KB
testcase_08 AC 39 ms
53,876 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 40 ms
53,876 KB
testcase_12 AC 40 ms
53,876 KB
testcase_13 AC 38 ms
53,576 KB
testcase_14 AC 38 ms
53,576 KB
testcase_15 AC 39 ms
53,876 KB
testcase_16 AC 39 ms
53,876 KB
testcase_17 AC 54 ms
73,448 KB
testcase_18 AC 53 ms
73,448 KB
testcase_19 AC 64 ms
76,376 KB
testcase_20 AC 115 ms
75,888 KB
testcase_21 AC 117 ms
77,400 KB
testcase_22 AC 86 ms
70,848 KB
testcase_23 AC 51 ms
66,652 KB
testcase_24 AC 113 ms
73,164 KB
testcase_25 AC 97 ms
71,116 KB
testcase_26 AC 55 ms
70,156 KB
testcase_27 AC 120 ms
78,532 KB
testcase_28 AC 71 ms
76,472 KB
testcase_29 AC 118 ms
78,532 KB
testcase_30 AC 107 ms
78,524 KB
testcase_31 AC 51 ms
68,700 KB
testcase_32 AC 51 ms
68,700 KB
testcase_33 AC 48 ms
62,556 KB
testcase_34 AC 62 ms
68,796 KB
testcase_35 AC 56 ms
70,136 KB
testcase_36 AC 60 ms
69,252 KB
testcase_37 AC 73 ms
71,384 KB
testcase_38 AC 58 ms
70,164 KB
testcase_39 AC 53 ms
70,132 KB
testcase_40 AC 51 ms
68,700 KB
testcase_41 AC 56 ms
72,916 KB
testcase_42 AC 54 ms
70,848 KB
testcase_43 AC 61 ms
72,920 KB
testcase_44 AC 53 ms
70,132 KB
testcase_45 AC 54 ms
70,132 KB
testcase_46 AC 74 ms
72,280 KB
testcase_47 AC 68 ms
72,280 KB
testcase_48 WA -
testcase_49 AC 52 ms
69,988 KB
testcase_50 AC 52 ms
70,124 KB
testcase_51 AC 58 ms
73,288 KB
testcase_52 AC 60 ms
75,328 KB
testcase_53 AC 54 ms
71,832 KB
testcase_54 AC 54 ms
71,832 KB
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
権限があれば一括ダウンロードができます

ソースコード

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()))
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()

c = [0] * 40000
for i in range(n):
	c[a[i]] = 1
for i in range(m):
	c[b[i]] = 1

v = 0
for i in range(1, 40000):
	if c[i] == 0:
		v = i ** 2
		break

k = v
while True:
	mode = 0
	for i in makediv(k):
		j = k // i
		x = bisect.bisect_left(a2, i) - 1
		y = bisect.bisect_left(b2, j) - 1
		if x < 0 or y < 0:
			continue
		if not a[x] ** 2 <= i < (a[x] + 1) ** 2:
			continue
		if not b[y] ** 2 <= j < (b[y] + 1) ** 2:
			continue
		mode = 1
		break
	if not mode:
		break
	k += 1

print(k)
0