結果

問題 No.1120 Strange Teacher
ユーザー neterukunneterukun
提出日時 2020-07-22 22:05:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 403 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 101,416 KB
最終ジャッジ日時 2023-09-04 20:38:53
合計ジャッジ時間 5,479 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,432 KB
testcase_01 AC 71 ms
71,232 KB
testcase_02 AC 74 ms
75,756 KB
testcase_03 AC 78 ms
76,312 KB
testcase_04 AC 114 ms
101,180 KB
testcase_05 AC 113 ms
101,116 KB
testcase_06 AC 111 ms
101,120 KB
testcase_07 AC 110 ms
101,416 KB
testcase_08 AC 112 ms
101,212 KB
testcase_09 AC 70 ms
71,432 KB
testcase_10 AC 109 ms
101,148 KB
testcase_11 AC 111 ms
101,116 KB
testcase_12 AC 109 ms
101,144 KB
testcase_13 AC 108 ms
101,120 KB
testcase_14 AC 111 ms
101,168 KB
testcase_15 AC 109 ms
101,080 KB
testcase_16 AC 109 ms
101,296 KB
testcase_17 AC 109 ms
101,152 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 69 ms
71,320 KB
testcase_23 AC 69 ms
71,332 KB
testcase_24 AC 110 ms
100,336 KB
testcase_25 RE -
testcase_26 AC 71 ms
71,220 KB
testcase_27 AC 72 ms
71,112 KB
testcase_28 AC 71 ms
71,092 KB
testcase_29 AC 72 ms
71,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))


diff = 0
for i in range(n):
    diff += a[i] - b[i]

if diff % (n - 2) == 0 and diff // (n - 2) > 0:
    cnt = diff // (n - 2)
else:
    print(-1)
    exit()

for i in range(n):
    d = cnt - (a[i] - b[i])
    if d % 2 == 0 and d >= 0:
        continue
    else:
        print(-1)
        exit()
print(cnt)
    
0