結果

問題 No.1120 Strange Teacher
ユーザー brthyyjp
提出日時 2020-08-02 01:38:22
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 407 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 82,420 KB
実行使用メモリ 103,892 KB
最終ジャッジ日時 2024-07-16 00:37:54
合計ジャッジ時間 4,124 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

S = 0
for a, b in zip(A, B):
    S += a-b
#print(S)
if S%(n-2) == 0:
    x = S//(n-2)
    for a, b in zip(A, B):
        if b-a+x < 0:
            print(-1)
            exit()
        else:
            if (b-a+x)%2 != 0:
                print(-1)
                exit()
    else:
        print(x)
else:
    print(-1)
0