結果
| 問題 |
No.1120 Strange Teacher
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-04 18:04:19 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 387 bytes |
| コンパイル時間 | 171 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 92,812 KB |
| 最終ジャッジ日時 | 2024-11-19 00:13:51 |
| 合計ジャッジ時間 | 3,511 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 WA * 14 |
ソースコード
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)