結果
| 問題 |
No.1120 Strange Teacher
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-24 14:47:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 105 ms / 1,000 ms |
| コード長 | 368 bytes |
| コンパイル時間 | 243 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 102,408 KB |
| 最終ジャッジ日時 | 2024-06-25 03:09:38 |
| 合計ジャッジ時間 | 3,692 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
n=int(input())
*a,=map(int,input().split())
*b,=map(int,input().split())
dif=sum(a)-sum(b)
if n==2:
if dif!=0:
print(-1)
else:
print(abs(a[0]-b[0]))
elif dif>=0 and dif%(n-2)==0:
x=dif//(n-2)
for i in range(n):
if (b[i]-(a[i]-x))%2==1 or b[i]<(a[i]-x):
print(-1)
exit()
print(x)
else:
print(-1)