結果

問題 No.1120 Strange Teacher
ユーザー stngstng
提出日時 2022-09-04 18:04:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 387 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 92,672 KB
最終ジャッジ日時 2024-04-29 18:14:50
合計ジャッジ時間 3,479 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 40 ms
51,968 KB
testcase_10 AC 102 ms
92,160 KB
testcase_11 AC 102 ms
92,416 KB
testcase_12 AC 101 ms
92,160 KB
testcase_13 AC 95 ms
92,288 KB
testcase_14 AC 95 ms
92,032 KB
testcase_15 AC 87 ms
91,008 KB
testcase_16 AC 96 ms
92,160 KB
testcase_17 AC 86 ms
91,264 KB
testcase_18 AC 40 ms
51,840 KB
testcase_19 AC 88 ms
92,672 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 40 ms
51,584 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 40 ms
51,840 KB
testcase_26 WA -
testcase_27 AC 41 ms
51,712 KB
testcase_28 AC 40 ms
51,968 KB
testcase_29 AC 40 ms
51,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

li = [0]*n
ans = 0
for i in range(n):
    li[i] = b[i]-a[i]

li.sort(reverse=True)
ans = -li[n-1]

tmp = 0

for i in range(n-1):
    tmp -= li[i]

if ans == tmp:
    print(ans)
elif ans > tmp:
    print(-1)
elif abs(ans-tmp) % (n-2) == 0:
    print(ans+abs(ans-tmp)//(n-2))
else:
    print(-1)
0