結果

問題 No.1120 Strange Teacher
ユーザー isacaisaca
提出日時 2020-07-25 11:35:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 273 bytes
コンパイル時間 782 ms
コンパイル使用メモリ 10,700 KB
実行使用メモリ 48,608 KB
最終ジャッジ日時 2023-09-09 08:04:35
合計ジャッジ時間 9,127 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 121 ms
29,584 KB
testcase_10 AC 218 ms
48,592 KB
testcase_11 AC 221 ms
48,420 KB
testcase_12 AC 221 ms
48,608 KB
testcase_13 AC 200 ms
44,652 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 123 ms
29,516 KB
testcase_19 AC 198 ms
44,996 KB
testcase_20 AC 123 ms
29,648 KB
testcase_21 AC 122 ms
29,572 KB
testcase_22 AC 122 ms
29,696 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 122 ms
29,560 KB
testcase_26 WA -
testcase_27 AC 122 ms
29,620 KB
testcase_28 AC 121 ms
29,516 KB
testcase_29 AC 123 ms
29,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ab = []
for a,b in zip(A,B):
    ab.append(abs(a-b))
ab = list(set(ab))
x = np.gcd.reduce(ab)
if x == 1 and ab!=[1]:
    print(-1)
else:
    print(np.lcm.reduce(ab))
0