結果
| 問題 |
No.1120 Strange Teacher
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-02 08:12:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 99 ms / 1,000 ms |
| コード長 | 361 bytes |
| コンパイル時間 | 260 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 103,296 KB |
| 最終ジャッジ日時 | 2024-11-29 11:17:07 |
| 合計ジャッジ時間 | 4,545 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
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:
a=sum(A)
b=sum(B)
if (a-b)%(N-2)==0:
x=(a-b)//(N-2)
for i in range(N):
d=x-A[i]+B[i]
if d<0 or d%2==1:
print(-1)
exit()
print(x)
else:
print(-1)