結果
問題 | No.1120 Strange Teacher |
ユーザー |
![]() |
提出日時 | 2020-07-22 22:09:13 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 87 ms / 1,000 ms |
コード長 | 506 bytes |
コンパイル時間 | 247 ms |
コンパイル使用メモリ | 82,060 KB |
実行使用メモリ | 103,708 KB |
最終ジャッジ日時 | 2024-06-22 18:19:56 |
合計ジャッジ時間 | 3,196 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
n = int(input())a = list(map(int, input().split()))b = list(map(int, input().split()))diff = 0for i in range(n):diff += a[i] - b[i]if n == 2:if sum(a) != sum(b):print(-1)else:print(abs(a[0] - b[0]))exit()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:continueelse:print(-1)exit()print(cnt)