結果
問題 | No.2244 Integer Complete |
ユーザー | shobonvip |
提出日時 | 2023-03-08 05:15:09 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 121 ms / 2,000 ms |
コード長 | 1,222 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 82,196 KB |
実行使用メモリ | 79,780 KB |
最終ジャッジ日時 | 2024-09-18 02:27:24 |
合計ジャッジ時間 | 5,595 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
53,144 KB |
testcase_01 | AC | 39 ms
53,448 KB |
testcase_02 | AC | 39 ms
53,588 KB |
testcase_03 | AC | 39 ms
52,992 KB |
testcase_04 | AC | 39 ms
53,788 KB |
testcase_05 | AC | 39 ms
53,892 KB |
testcase_06 | AC | 44 ms
54,548 KB |
testcase_07 | AC | 40 ms
53,808 KB |
testcase_08 | AC | 40 ms
54,648 KB |
testcase_09 | AC | 41 ms
53,308 KB |
testcase_10 | AC | 40 ms
53,084 KB |
testcase_11 | AC | 40 ms
53,136 KB |
testcase_12 | AC | 38 ms
53,608 KB |
testcase_13 | AC | 39 ms
53,276 KB |
testcase_14 | AC | 40 ms
53,628 KB |
testcase_15 | AC | 41 ms
53,584 KB |
testcase_16 | AC | 39 ms
53,796 KB |
testcase_17 | AC | 59 ms
75,080 KB |
testcase_18 | AC | 59 ms
75,692 KB |
testcase_19 | AC | 70 ms
76,856 KB |
testcase_20 | AC | 118 ms
77,040 KB |
testcase_21 | AC | 121 ms
79,284 KB |
testcase_22 | AC | 89 ms
72,764 KB |
testcase_23 | AC | 56 ms
69,712 KB |
testcase_24 | AC | 115 ms
74,512 KB |
testcase_25 | AC | 101 ms
74,224 KB |
testcase_26 | AC | 60 ms
73,176 KB |
testcase_27 | AC | 120 ms
79,608 KB |
testcase_28 | AC | 76 ms
79,640 KB |
testcase_29 | AC | 121 ms
79,780 KB |
testcase_30 | AC | 111 ms
79,068 KB |
testcase_31 | AC | 57 ms
71,244 KB |
testcase_32 | AC | 54 ms
70,088 KB |
testcase_33 | AC | 54 ms
65,228 KB |
testcase_34 | AC | 67 ms
71,272 KB |
testcase_35 | AC | 61 ms
71,648 KB |
testcase_36 | AC | 65 ms
71,524 KB |
testcase_37 | AC | 77 ms
73,780 KB |
testcase_38 | AC | 63 ms
72,516 KB |
testcase_39 | AC | 59 ms
71,804 KB |
testcase_40 | AC | 57 ms
69,900 KB |
testcase_41 | AC | 61 ms
74,980 KB |
testcase_42 | AC | 60 ms
73,264 KB |
testcase_43 | AC | 67 ms
74,364 KB |
testcase_44 | AC | 58 ms
71,468 KB |
testcase_45 | AC | 58 ms
72,264 KB |
testcase_46 | AC | 75 ms
73,736 KB |
testcase_47 | AC | 68 ms
73,784 KB |
testcase_48 | AC | 57 ms
71,348 KB |
testcase_49 | AC | 59 ms
71,724 KB |
testcase_50 | AC | 59 ms
72,220 KB |
testcase_51 | AC | 64 ms
77,152 KB |
testcase_52 | AC | 66 ms
76,848 KB |
testcase_53 | AC | 59 ms
73,520 KB |
testcase_54 | AC | 60 ms
73,572 KB |
testcase_55 | AC | 58 ms
66,880 KB |
testcase_56 | AC | 56 ms
66,972 KB |
testcase_57 | AC | 50 ms
62,496 KB |
testcase_58 | AC | 62 ms
71,256 KB |
testcase_59 | AC | 61 ms
72,576 KB |
ソースコード
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() 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_right(a2, i) - 1 y = bisect.bisect_right(b2, j) - 1 if x < 0 or y < 0: continue #print(k, i, j, a[x], b[y]) 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)