結果
問題 |
No.1120 Strange Teacher
|
ユーザー |
![]() |
提出日時 | 2020-07-22 21:28:35 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 578 bytes |
コンパイル時間 | 260 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 25,340 KB |
最終ジャッジ日時 | 2024-06-22 13:35:39 |
合計ジャッジ時間 | 3,743 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 1 |
ソースコード
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) if n == 2: if sum(a) == sum(b): print(abs(a[0] - b[0])) else: print(-1) else: t = sum(a) - sum(b) if t >= 0 and t % (n - 2) == 0: t //= n - 2 res = 0 for i in range(n): k = b[i] - a[i] + t if k < 0: print(-1) break res += k else: if res // 2 == t: print(t) else: print(-1) else: print(-1)