結果

問題 No.1120 Strange Teacher
ユーザー ytft
提出日時 2021-05-07 08:44:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 392 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 82,324 KB
実行使用メモリ 103,780 KB
最終ジャッジ日時 2024-09-14 21:54:27
合計ジャッジ時間 3,455 ms
ジャッジサーバーID
(参考情報)
judge6 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 16 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
flg=0
if N==2:
    if sum(A)==sum(B):
        flg=1
        time=abs(A[0]-B[0])
else:
    if (sum(A)-sum(B))%(N-2)==0:
        time=(sum(A)-sum(B))//(N-2)
        flg=1
        for i in range(N):
            if (A[i]-B[i]+time)%2==1 or (B[i]>A[i]-time):
                flg=0
print(time if flg else -1)
        
0