結果
| 問題 |
No.1120 Strange Teacher
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-04 16:41:18 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 457 bytes |
| コンパイル時間 | 573 ms |
| コンパイル使用メモリ | 81,792 KB |
| 実行使用メモリ | 103,648 KB |
| 最終ジャッジ日時 | 2024-12-14 07:37:36 |
| 合計ジャッジ時間 | 3,350 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 WA * 4 |
ソースコード
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
tota = sum(A)
totb = sum(B)
if n == 2:
if tota == totb:
print(abs(A[0] - B[0]))
else:
print(-1)
exit()
d = tota - totb
if d < 0:
print(-1)
exit()
if d % (n - 2) != 0:
print(-1)
exit()
cnt = d // (n - 2)
A = [a - cnt for a in A]
tot = sum(max(a - b, 0) for a, b in zip(A, B))
if tot > cnt:
print(-1)
else:
print(cnt)