結果
問題 | No.1120 Strange Teacher |
ユーザー |
👑 |
提出日時 | 2022-07-04 16:40:04 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 433 bytes |
コンパイル時間 | 2,250 ms |
コンパイル使用メモリ | 82,172 KB |
実行使用メモリ | 104,192 KB |
最終ジャッジ日時 | 2024-12-14 07:36:04 |
合計ジャッジ時間 | 5,269 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 1 |
ソースコード
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]if any(a > b for a, b in zip(A, B)):print(-1)else:print(cnt)