結果

問題 No.1120 Strange Teacher
ユーザー 👑 KazunKazun
提出日時 2020-07-22 21:45:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 424 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 101,412 KB
最終ジャッジ日時 2023-09-04 17:04:56
合計ジャッジ時間 4,843 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 76 ms
71,544 KB
testcase_10 AC 119 ms
101,412 KB
testcase_11 AC 119 ms
101,096 KB
testcase_12 AC 120 ms
101,148 KB
testcase_13 AC 119 ms
101,224 KB
testcase_14 AC 120 ms
101,120 KB
testcase_15 AC 119 ms
101,092 KB
testcase_16 AC 122 ms
101,168 KB
testcase_17 AC 118 ms
101,092 KB
testcase_18 AC 74 ms
71,392 KB
testcase_19 AC 118 ms
99,688 KB
testcase_20 AC 72 ms
71,360 KB
testcase_21 AC 70 ms
71,444 KB
testcase_22 AC 71 ms
71,324 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 71 ms
71,400 KB
testcase_26 AC 75 ms
71,484 KB
testcase_27 AC 73 ms
71,228 KB
testcase_28 AC 71 ms
71,520 KB
testcase_29 AC 74 ms
71,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

D=[A[i]-B[i] for i in range(N)]

if N!=2:
    E=sum(D)

    F=True
    H=0
    for i in range(N):
        X=E-2*D[i]
        if X>=0 and X%N==0:
            H+=X//N
        else:
            F=False

    if F:
        print(H)
    else:
        print(-1)
else:
    if sum(A)==sum(B):
        print(abs(A[0]-B[0]))
    else:
        print(-1)
0