結果

問題 No.1120 Strange Teacher
ユーザー 👑 KazunKazun
提出日時 2020-07-22 21:50:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 419 bytes
コンパイル時間 379 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 101,488 KB
最終ジャッジ日時 2023-09-04 17:41:25
合計ジャッジ時間 4,704 ms
ジャッジサーバーID
(参考情報)
judge13 / 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 70 ms
71,324 KB
testcase_10 AC 110 ms
101,284 KB
testcase_11 AC 111 ms
101,164 KB
testcase_12 AC 110 ms
101,192 KB
testcase_13 AC 112 ms
101,076 KB
testcase_14 AC 109 ms
101,192 KB
testcase_15 AC 111 ms
101,264 KB
testcase_16 AC 112 ms
101,136 KB
testcase_17 AC 114 ms
101,036 KB
testcase_18 AC 70 ms
71,264 KB
testcase_19 AC 111 ms
99,624 KB
testcase_20 AC 70 ms
71,236 KB
testcase_21 AC 69 ms
71,248 KB
testcase_22 AC 68 ms
71,260 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 69 ms
71,284 KB
testcase_26 AC 69 ms
71,244 KB
testcase_27 AC 69 ms
71,296 KB
testcase_28 AC 70 ms
71,236 KB
testcase_29 AC 69 ms
71,428 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)]
E=sum(D)

if N>=3:
    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