結果
問題 | No.1120 Strange Teacher |
ユーザー |
|
提出日時 | 2022-05-29 14:56:39 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 87 ms / 1,000 ms |
コード長 | 521 bytes |
コンパイル時間 | 746 ms |
コンパイル使用メモリ | 82,400 KB |
実行使用メモリ | 103,724 KB |
最終ジャッジ日時 | 2024-09-21 00:01:57 |
合計ジャッジ時間 | 4,920 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
N = int(input())A = list(map(int,input().split()))B = list(map(int,input().split()))a = sum(A)b = sum(B)import sysif N == 2:if a != b:print(-1)exit()else:ans = abs(A[0] - B[0])print(ans)exit()if a < b:print(-1)exit()if (a - b) % (N - 2) != 0:print(-1)exit()q = (a - b) // (N - 2)#print(q)for a,b in zip(A,B):a -= qif a > b:print(-1)exit()if (b - a) % 2 != 0:print(-1)exit()print(q)