結果

問題 No.1120 Strange Teacher
ユーザー tikitaka1201tikitaka1201
提出日時 2020-07-24 14:39:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 350 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 101,020 KB
最終ジャッジ日時 2023-09-07 08:39:54
合計ジャッジ時間 4,859 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,360 KB
testcase_01 AC 70 ms
71,172 KB
testcase_02 AC 73 ms
75,300 KB
testcase_03 AC 77 ms
76,156 KB
testcase_04 AC 117 ms
98,512 KB
testcase_05 AC 119 ms
98,536 KB
testcase_06 AC 118 ms
98,336 KB
testcase_07 AC 118 ms
98,220 KB
testcase_08 AC 115 ms
98,432 KB
testcase_09 AC 71 ms
71,364 KB
testcase_10 AC 115 ms
97,856 KB
testcase_11 AC 113 ms
97,692 KB
testcase_12 AC 113 ms
97,812 KB
testcase_13 AC 115 ms
98,448 KB
testcase_14 AC 115 ms
98,344 KB
testcase_15 AC 113 ms
98,368 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 70 ms
71,128 KB
testcase_19 AC 119 ms
96,896 KB
testcase_20 AC 71 ms
70,860 KB
testcase_21 AC 70 ms
71,364 KB
testcase_22 AC 71 ms
71,148 KB
testcase_23 AC 70 ms
71,008 KB
testcase_24 AC 113 ms
101,020 KB
testcase_25 AC 70 ms
70,864 KB
testcase_26 AC 71 ms
71,316 KB
testcase_27 AC 71 ms
71,144 KB
testcase_28 AC 73 ms
71,028 KB
testcase_29 AC 72 ms
71,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
*a,=map(int,input().split())
*b,=map(int,input().split())
dif=sum(a)-sum(b)

if n==2:
    if dif!=0:
        print(-1)
    else:
        print(abs(a[0]-b[0]))
elif dif>=0 and dif%(n-2)==0:
    x=dif//(n-2)
    for i in range(n):
        if (b[i]-(a[i]-x))%2==1:
            print(-1)
            exit()
    print(x)
else:
    print(-1)
0