結果
問題 | No.1120 Strange Teacher |
ユーザー |
![]() |
提出日時 | 2023-04-02 23:38:29 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 88 ms / 1,000 ms |
コード長 | 467 bytes |
コンパイル時間 | 309 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 103,668 KB |
最終ジャッジ日時 | 2024-09-25 00:40:41 |
合計ジャッジ時間 | 4,513 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
N = int(input())A = list(map(int, input().split()))B = list(map(int, input().split()))SA, SB = sum(A), sum(B)if N == 2:if SA == SB:print(abs(A[0] - B[0]))else:print(-1)else:if (SA - SB) % (N - 2):print(-1)exit()n = (SA - SB) // (N - 2)for i in range(N):A[i] -= nfor i in range(N):if B[i] - A[i] < 0 or (B[i] - A[i]) % 2:print(-1)exit()print(n)