結果
問題 | No.1120 Strange Teacher |
ユーザー |
👑 |
提出日時 | 2022-07-04 16:41:09 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 457 bytes |
コンパイル時間 | 338 ms |
コンパイル使用メモリ | 81,968 KB |
実行使用メモリ | 103,636 KB |
最終ジャッジ日時 | 2024-12-14 07:37:29 |
合計ジャッジ時間 | 3,551 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | AC * 15 WA * 12 |
ソースコード
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 - totbif 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)