結果
| 問題 | No.2244 Integer Complete |
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 01:01:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,244 bytes |
| 記録 | |
| コンパイル時間 | 247 ms |
| コンパイル使用メモリ | 81,868 KB |
| 実行使用メモリ | 72,124 KB |
| 最終ジャッジ日時 | 2025-04-16 01:03:19 |
| 合計ジャッジ時間 | 5,771 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 TLE * 1 -- * 40 |
ソースコード
import bisect
import math
def main():
n, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.sort()
B.sort()
a_min = A[0]
b_min = B[0]
if (a_min ** 2) * (b_min ** 2) > 1:
print(1)
return
def is_in_A(x):
s = int(math.isqrt(x))
if s * s > x:
s -= 1
idx = bisect.bisect_left(A, s)
return idx < len(A) and A[idx] == s and (s ** 2 <= x < (s + 1) ** 2)
def is_in_B(y):
t = int(math.isqrt(y))
if t * t > y:
t -= 1
idx = bisect.bisect_left(B, t)
return idx < len(B) and B[idx] == t and (t ** 2 <= y < (t + 1) ** 2)
k = 1
while True:
divisors = set()
for i in range(1, int(math.isqrt(k)) + 1):
if k % i == 0:
divisors.add(i)
divisors.add(k // i)
possible = False
for x in divisors:
if is_in_A(x):
y = k // x
if is_in_B(y):
possible = True
break
if not possible:
print(k)
return
k += 1
if __name__ == "__main__":
main()
lam6er