結果
問題 |
No.2244 Integer Complete
|
ユーザー |
![]() |
提出日時 | 2025-04-16 01:00:32 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,252 bytes |
コンパイル時間 | 280 ms |
コンパイル使用メモリ | 82,268 KB |
実行使用メモリ | 93,344 KB |
最終ジャッジ日時 | 2025-04-16 01:02:00 |
合計ジャッジ時間 | 5,167 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 TLE * 1 -- * 40 |
ソースコード
import sys import math def main(): input = sys.stdin.read().split() ptr = 0 N, M = int(input[ptr]), int(input[ptr+1]) ptr +=2 A = list(map(int, input[ptr:ptr+N])) ptr +=N B = list(map(int, input[ptr:ptr+M])) ptr +=M def is_in(x, arr): left = 0 right = len(arr) -1 res = -1 while left <= right: mid = (left + right) //2 a = arr[mid] a_sq = a * a if a_sq <= x: res = mid left = mid +1 else: right = mid -1 if res == -1: return False return x < (arr[res] +1) **2 k = 1 while True: max_d = int(math.isqrt(k)) found = False for d in range(1, max_d +1): if k % d !=0: continue e = k // d # Check d in A and e in B if is_in(d, A) and is_in(e, B): found = True break # Check e in A and d in B if d != e and is_in(e, A) and is_in(d, B): found = True break if not found: print(k) return k +=1 if __name__ == "__main__": main()